Hi all!
I'm creating some AJAX POC's here at work, and I've run across this issue; but first, this is what I'm POC'ing...
#1. Create a html page that used Javascript to connect to my backend via AJAX and get the data it needs. This I have working in a limited fastion.
#2. I need to stream the data back to me, like "server says '1'", then "2" etc until it says 100.
#3. So I created a simple script that I call from the browser to test this "streaming"
This is the sample code
Code:
#!/usr/bin/perl
$| = 1;
print "Content-type: text/html\r\n\r\n";
print "<html>";
print "<head>";
print "<title>Callback Test #1</title>";
print '<meta content="no-cache" http-equiv="pragma"/>';
print '<meta content="-1" http-equiv="expires"/>';
print "</head>";
print "<body>";
print "<div id='myData'>";
print "Empty!";
print "</div>";
for($i=0;$i<10;$i++)
{
print "<script language='JavaScript'>\r\n";
print "document.getElementById('myData').innerHTML='Counter is [$i]';\r\n";
print "</script>\r\n";
sleep(1);
}
print "</body>\n";
print "</html>\n";
On Firefox, I see the numbers 0~9 being displayed (

)
On Safari and Chrome, it just shows the last one, but does wait the correct time...
I would guess that they are not processing the javascript tags realtime?
This is the sample "backend" I will use in my AJAX demo...
Thoughts?
~Kam (^8*