2

Possible Duplicate:
Pass in an array of Deferreds to $.when()

Is there anyway to pass the jquery deferred $.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!

Community
  • 1
  • 1

1 Answers1

5
$.when.apply( $, arr ).then(function( a, b ) { ... });
Julian Aubourg
  • 11,346
  • 1
  • 29
  • 29