Sometimes it seems that a request is frozen. How can I cancel it and call it again when it takes a long time?
Sometimes the latency is more than 10 minutes because the Ajax post checks the Twitter API, and Twitter API sometimes, you know! :)
Sometimes it seems that a request is frozen. How can I cancel it and call it again when it takes a long time?
Sometimes the latency is more than 10 minutes because the Ajax post checks the Twitter API, and Twitter API sometimes, you know! :)
You can use the timeout option. Have a look at the documentation.
You can set the timeout at a reasonable value. If a timeout occurs, the callback error will be called and the second argument will have "timeout" as value.
you can always place that call in a timeout or a queue and perform it ever x minutes... when it's thr, set a boolean variable to true and when that time comes, it will not call the function... when you need to call that again, set it again to false...
var getResults = true;
settimeout( function() {
if( getResults ) {
// call your ajax method
...
onSuccess:
...
getResults = false;
}
}, 1000 );
something like this...