Per this post: https://stackoverflow.com/a/17548609/985704
Using jQuery.when to perform multiple simultaneous ajax requests.
var requests = Array();
requests.push($.get('responsePage.php?data=foo'));
requests.push($.get('responsePage.php?data=bar'));
var defer = $.when.apply($, requests);
defer.done(function(){
// This is executed only after every ajax request has been completed
$.each(arguments, function(index, responseData){
// "responseData" will contain an array of response information for each specific request
});
});
When all requests are done, can I be sure that the arguments (of the $.each) are in the same order as the requests? Is this documented somewhere?