jquery - Ajax How to get Multiple Response while response is generating -


i want know if it's possible print while ajax processing request.if yes please let me know, because facing 1 problem , want print in between ajax call request , it's response comes

actually want read csv of 3000+ rows , in between process want display no of rows read , copied in csv.

so want show process bar out of 3000 there 50 rows copies , continue process until reach 3000 rows.

it there way let me know!

you can use xhr progress events (if browser supports them):

https://developer.mozilla.org/en-us/docs/dom/xmlhttprequest/using_xmlhttprequest#monitoring_progress

https://dvcs.w3.org/hg/progress/raw-file/tip/overview.html#interface-progressevent

how check in javascript if xmlhttprequest object supports w3c progress events?

but question more i have 1000 bytes out of possible 9999. want know how many rows have read point.

i think can read xhr.responsetext on each progress event, if request parseable when incomplete (such plain text), , when not using async request - https://stackoverflow.com/a/5319647/319878.

but libraries zip.js use non-text binary data arraybuffers when requesting zip content, not work, these requests must async (http://www.w3.org/tr/xmlhttprequest/#the-responsetype-attribute). if try use xhr.responsetext in case, error (example firefox):

[exception... "an attempt made use object not, or no longer, usable" code: "11" nsresult: "0x8053000b (invalidstateerror)" location: "http://localhost/xhr-progress-test/test-xhr-on-progress.html line: 1075"] 

so zipped content (using zip.js) think have wait of response arrive before using it. not want.

much simpler modify server code return selection of rows @ time. e.g. rows 1-100, 101-200, etc.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -