I got a dynamic asynchronous request (for the jsfiddle I used ajax) that I need to wait regardless of success or failure, which means I only need to know that all are processes are finished even if some request failed.
//Dynamic: In my case this is produced by an ajax request so the number of followup async request is flexible
So I originally used this code:
$.when.apply($,deferreds).done(function() {
$("div").append("<p>All done!</p>");
}).fail(function(){
$("div").append("<p>Something failed!</p>");
});
But in the scenario that one of the deferred failed, the fail callback will be called immediately. I tried changing it to always() but the result is:
Uncaught TypeError: Object # has no method 'always'
So how can I implement an always() kind of solution for this?
My original source: jQuery Deferred - waiting for multiple AJAX requests to finish