开发者

Anyway to pass the jquery deferred $.when an array? [duplicate]

This question already has answers here: Closed 11 years ago.

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 ) { ... });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜