javascript - PHP with comet/ajax and ob_flush -


i'm trying use ob_flush() , flush() typo3 controller, result weird. in web-browser console can see each flush not lead 1 response in javascript; there's no one-to-one correspondence between flush on server , reaction in javascript. code:

// php foreach ($ids $id) {   echo $id;   ob_flush(); // <-- flush 1, 2, 3, ...   flush();   // more data processing... }  // javascript var xhr = new xmlhttprequest(); xhr.onreadystatechange = function() {   if (xhr.readystate == 4 && xhr.status == 200) {   }   else if (xhr.readystate > 2) {     console.log(xhr.responsetext); // <-- can log "123" in 1 go   } } 

how force 1 flush lead 1 response in javascript?

could flush occurs apache2 don't have time react?

edit: solved including after echo:

echo str_pad('',4096)."\n";     


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -