| 
	
 | 
 Posted by amygdala on 04/19/07 08:36 
"Marvin Zhang" <zyeming@gmail.com> schreef in bericht  
news:1176969782.001596.208900@e65g2000hsc.googlegroups.com... 
>> The XMLHttpRequest object for using AJAX stuff has a property  
>> 'readyState' 
>> which can be: 
>> 
>> 0 // Uninitialized 
>> 1 // Loading 
>> 2 // Loaded 
>> 3 // Interactive 
>> 4 // Finished 
>> 
>> If I were to hack something you have in mind I would look at Loading and 
>> Interactive (not sure what the latter does) 
>> 
>> My guess is that if you address one of these while the page is loading  
>> and 
>> have PHP flush the buffer once in a while you could catch an XML node  
>> called 
>> 'loadedSoFar' or any output for that matter to poll the state of the  
>> page. 
> 
> Hi, 
> 
> Thank you for you reply. 
> 
> I tried this method. Under Firefox, it works great. Every time the 
> server script calls flush(), the callback function of Ajax request 
> will be called with readyState set to 3. So I can update the progress 
> with the responseText variable. But unfortunately, this doesn't work 
> in IE. In IE, the callback will only be called only once with 
> readyState set to 3. 
> 
 
Alright, maybe the following will be a big resource hog on the client: 
But what about (in IE that is) a javascript loop to poll responseText, say  
every 500ms, for as long as readyState is 3 and hasn't changed? 
 
By the way, I'm curious: how is your alternative coming along? 
 
Cause what I didn't quite understand is how your suggested alternative  
differs from the initial problem. You said you would poll the database now,  
in stead of a session var right? But how are you gonna do that without a  
second AJAX object? 
 
Cheers
 
[Back to original message] 
 |