[jQuery] Timeout is triggered after calling .abort() on xhr request
Hi!
I'v found that aborting ajax request that has timeout set, doesn't
stop timeout event from occuring. My code is something like:
--------------------------------------------------
$.ajaxSetup({
timeout:120000
});
var req = $.ajax({url:AJAX_URLS.my_url,
type: 'GET',
dataType: 'json',
error: function(data, textStatus,
errorThrown){ this_obj.error_handler(data, textStatus,
errorThrown); },
success: function(data)
{ this_obj.success_handler(data); }
});
(...)
// somewhere else:
req.abort();
req = null;
--------------------------------------------------
Even though abort() is called, and req is set to null, timeout still
happens and error handler is called. Seems for me to be a kind of
bug.
I've looked into jQuery code and seems that there is no way to stop
timeout from being triggered. Maybe I should handle this in my error
handler, but I'm not sure how can I check if timeout has happened for
aborted request or for new one that could appear meanwhile?
Any ideas?