开发者

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

开发者 https://www.devze.com 2023-03-15 03:48 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Pass in an array of Deferreds to $.when()
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

精彩评论

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