Possible Duplicate:
Pass in an array of Deferreds to $.when()
Is there anyway to pass the jquery defe开发者_开发技巧rred $.when an array of ajax functions? Example:
var arr = [
$.getJSON(window.location, function() { alert('yes') }),
$.getJSON(window.location, function() { alert('yes') })
]
$.when(arr).then(function(a, b) {
});
Thanks for your help!
$.when.apply( $, arr ).then(function( a, b ) { ... });
精彩评论