Re: Using Ajax to spit out a php-generated embed tag

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

 



I actually got it pretty quickly after reading the Rasmus AJAX tutorial
It was simple and easy to understand.
Thank you, Rasmus :)


I just needed to seemlessly launch the QuickTime player from a Flash page. Seems like Ajax is going to do this quite nicely.


g



On Oct 30, 2005, at 10:06 PM, Richard Lynch wrote:

You probably should be asking in an Ajax forum...

That said:

Ajax just goes and gets whatever is at a URL.

You can have the biggest, baddest PHP script at that URL that spits
out whatever you want.

Or it can always just spit out "42"

Ajax don't really care either way.

And PHP doesn't really care if Ajax is asking for AppleJacks is asking.

Somebody asks, PHP spits out the data.

So, YES, your Ajax can request a PHP URL and get back any HTML you
feel like.

For that matter, you *could* use Ajax to request the actual ".mov"
file, if you can get some kind of .mov player to run Ajax. And you
could have PHP spitting out the QT movie from a
http://php.net/readfile or similar.

Hell, you could write a PHP script to GENERATE a QuickTime movie on
the fly, if you knew QT internals enough to do it.

On Sun, October 30, 2005 6:34 pm, Graham Anderson wrote:


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





--
Like Music?
http://l-i-e.com/artists.htm



--
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