Note that there are some explanatory texts on larger screens.

plurals
  1. POXmlHttpRequest.responseText while loading (readyState==3) in Chrome
    primarykey
    data
    text
    <p>I am trying to "streaming" (from server to client) in Javascript by ajax (by XmlHttpRequest (=xhr). I am using modified handleResponse function described in <a href="https://stackoverflow.com/questions/1112413/cross-browser-implementation-of-http-streaming-push-ajax-pattern">Cross-browser implementation of &quot;HTTP Streaming&quot; (push) AJAX pattern</a></p> <pre><code>function handleResponse() { if (http.readyState != 4 &amp;&amp; http.readyState != 3) return; if (http.readyState == 3 &amp;&amp; http.status != 200) return; if (http.readyState == 4 &amp;&amp; http.status != 200) { clearInterval(pollTimer); inProgress = false; } // In konqueror http.responseText is sometimes null here... if (http.responseText === null) return; while (prevDataLength != http.responseText.length) { if (http.readyState == 4 &amp;&amp; prevDataLength == http.responseText.length) break; prevDataLength = http.responseText.length; var response = http.responseText.substring(nextLine); var lines = response.split('\n'); nextLine = nextLine + response.lastIndexOf('\n') + 1; if (response[response.length-1] != '\n') lines.pop(); for (var i = 0; i &lt; lines.length; i++) { // ... } } if (http.readyState == 4 &amp;&amp; prevDataLength == http.responseText.length) clearInterval(pollTimer); inProgress = false; } </code></pre> <p>With php script, which flushes me data (without ajax it really flushes data to browser while progressing)</p> <p>I have no problem in Firefox, but Google Chrome and IE give me an empty responseText while xhr.readyState equals to 3. I found that problem described in the Internet, but it didn't give me any solution.</p> <p>Do you know, how to pass by this implementation problem in Chrome? (w3c says, that responseText can't be NULL in readyState==3 - Chrome implemented this rule, but gives only empty string)</p> <p>And if you don't know, do you know any working solution in some products? (opensource frameworks, librararies etc.)</p> <p>Thanks a lot for your ideas.</p> <p><strong>Edit:</strong> The workaround is in creating iframe, call the script to iframe and flush data here and grab data by javascript from iframe. But this is not ajax solution. I really would like to see pure ajax solution.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload