Using Ajax to spit out a php-generated embed tag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Can you use AJAX to output an entire php-generated embed tag into a web page?

something  like:

<?php
// simple no frills qt embed
$qtembed = <<<EOB
<item>
<?xml version="1.0" encoding="UTF-8"?>
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" height="352" width="216" codebase="http://www.apple.com/qtactivex/ qtplugin.cab">
<embed src="themovie.mov" width="352" height="216">
</embed>
</object>
</item>
EOB;

header('Content-Type: text/xml'); // ajax only seems to like text/xml
header('Content-Length: '.strlen($qtembed));
echo $qtembed;
?>



I am a bit new to Ajax stuff, but thankfully, have been able to make simple examples work. From the examples I have tried thus far , it 'appears' that Ajax only supports sending/receiving elements like zip code....not entire tags Is there a way to 'curl' the html to see what 'xmlhttprequest' is sending and receiving ?

Maybe I am going about this the wrong way and there is a better solution? I wanted to avoid pop-up windows, launching new html pages, and iframes if possible. Ultimately, I want to dynamically write an invisible movie embed tag into an html document when called by some 'geturl' actionscript. Basically, click a button in a flash movie, and the quicktime player launches.

Instead, should I write a 'empty" quicktime movie tag into the html document with the element, moviename, for Ajax to target ?




many thanks in advance :)
g



this is the script I was attempting to modify:
http://developer.apple.com/internet/webcontent/XMLHttpRequestExample/ example.html



these are the two javascript functions where loadDoc is called by a form from the above html

function loadDoc(evt) {
    // equalize W3C/IE event models to get event object
    evt = (evt) ? evt : ((window.event) ? window.event : null);
    if (evt) {
        // equalize W3C/IE models to get event target reference
var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
        if (elem) {
            try {
                if (elem.selectedIndex > 0) {
                    loadXMLDoc(elem.options[elem.selectedIndex].value);
                }
            }
            catch(e) {
var msg = (typeof e == "string") ? e : ((e.message) ? e.message : "Unknown Error");
                alert("Unable to get XML data:\n" + msg);
                return;
            }
        }
    }
}

// retrieve text of an XML document element, including
// elements using namespaces
function getElementTextNS(prefix, local, parentElem, index) {
    var result = "";
    if (prefix && isIE) {
        // IE/Windows way of handling namespaces
result = parentElem.getElementsByTagName(prefix + ":" + local)[index];
    } else {
        // the namespace versions of this method
        // (getElementsByTagNameNS()) operate
        // differently in Safari and Mozilla, but both
        // return value with just local name, provided
        // there aren't conflicts with non-namespace element
        // names
        result = parentElem.getElementsByTagName(local)[index];
    }
    if (result) {
        // get text, accounting for possible
        // whitespace (carriage return) text nodes
        if (result.childNodes.length > 1) {
            return result.childNodes[1].nodeValue;
        } else {
            return result.firstChild.nodeValue;
        }
    } else {
        return "n/a";
    }
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux