Skip to content

Instantly share code, notes, and snippets.

@VITIMan
Last active November 3, 2015 08:52
Show Gist options
  • Save VITIMan/c984fa7ff7f44cd2736c to your computer and use it in GitHub Desktop.
Save VITIMan/c984fa7ff7f44cd2736c to your computer and use it in GitHub Desktop.
Jquery :: Wait until all requests are done
var requests = [];
Object.keys(sources).forEach(function(key){
requests.push(someAjaxAsyncRequest(arguments));
});
$.when.apply($, requests).done(function() {
console.log(arguments);
$.each(arguments, function (i, data) {
// By method
console.log(data);
});
// For every function
$("#retry-request").prop('disabled', false);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment