Skip to content Skip to sidebar Skip to footer

Wait Until A List Of Jquery Ajax Request Are Done?

It is almost the same with this question: Wait until all jQuery Ajax requests are done? But my question is imporve: That I'm doing many ajax requests, and I save them in an array:

Solution 1:

you need pass the promises as an argument list(like $.when(promise1, promise2, promise3)) to $.when(), not as an array so use Function.apply().

$.when.apply($, events).then(function() {
   // do something when all requests are done.
});

Post a Comment for "Wait Until A List Of Jquery Ajax Request Are Done?"