I have some jQuery ajax requests which I am running in parallel with a .when call. I want to ignore the ones that haven't returned after their timeout period.
Here is a simple form of it:
var ajax1 = $.ajax({url: url1,
timeout: 1000,
success: function() {
console.log("1 done");
}
});
var ajax2 = $.ajax({url: url2,
timeout: 1000,
success: function() {
console.log("2 done");
}
});
$.when(ajax1, ajax2).done(function() {
console.log("all done");
});
In the above example, if url1 doesn't respond without 1 second, I still want to reach the "all done". I know how to trap the timeout error in each ajax call, but I don't know how to flag the error as ignored.