views:

103

answers:

1

Is there any way I can parse a chunked response through AJAX as the chunks are being received?

For example, server.com/ping is set up so it sends a new chunk with some javascript in it, something like ping(), every 10 seconds which updates a number on the web page visible to the user. Is there a way to parse the individual "chunks" of information through AJAX, basically without reaching XHR state 4?

+1  A: 

You are looking for COMET

As alternative you might want to check the HTML5 WebSockets

jAndy
I currently use long polling but it's too cumbersome and I'm looking for a more streamlined approach, and I won't use web sockets for obvious reasons.
David Titarenco
I don't think there are much more alternatives using JS/jQuery. Especially if you don't want to use html5.
jAndy