I have a server page that the when called, generates data. For this example, lets say it outputs one new character every 100 ms, before it finishes after 1-60 seconds.
From the client, I want to be able to read the data from this request with some interval, e.g. every 200 ms. But - and this is important - I can not make another call to this page, it has to be the same request.
The problem is that when I use jQuery.ajax, the success function runs only when the request is finished. This means that I will only get the complete data, and only after (worst case) 60 seconds.
A dream would be if I could have something along this line:
$.ajax({
type: "GET",
url: "/continouscontent",
dataType: "html",
success: function(data) {
alert('Done');
},
pollInterval: 200,
onPoll: function(data) {
alert('Current data is: ' + data);
}
});
In the code above, pollInterval and onPoll are of course my speculative ideas.