I have a cross-domain long polling request using getJSON with a callback that looks something like this:
$.getJSON("http://long-polling.com/some.fcgi?jsoncallback=?"
function(data){
if(data.items[0].rval == 1) {
// update data in page
}
});
The problem is the request to the long-polling service might take a while to return, and another getJSON request might be made in the meantime and update the page even though it is a stale response.
Req1: h**p://long-polling.com/some.fcgi at 10:00 AM
Req2: h**p://long-polling.com/some.fcgi? at 10:01 AM
Req1 returns and updates the data on the page 10:02 AM
I want a way to invalidate the return from Req1 if Req2 has already been made.
Thanks!