There are situations when an ajax request fails and there is no reason to make a new attempt to re-send the last request, eg when getting an error code 404, 405 etc - because a new attempt will result always in the same.
But in some situations as server busy, timeout, and others(?) would can be interesting to have a routine that keeps trying to resend the request, and when it reaches a limit, display a message to the user if they want to stop the attempts - like in gmail when user have his connection lost.
Below I have the beginning of what I need.
$.ajaxSetup({
error: function(msg,e) {
console.warn(msg); // Example: "NetworkError: 405 Method Not Allowed ..."
console.warn(e); // Exception obj
}
});
Generically beyond busy server, timeout and what else case I could do a retry? And if so, how I can get the error code and the last request from ajax (URL, post data...)?