每这篇文章: https://stackoverflow.com/a/17548609/985704
使用jQuery.when可以执行多个同步Ajax请求。
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
});
});
当所有的请求都做了,我可以肯定的是(的$。每)参数是按顺序相同的请求? 这是记录在案的地方?