Get response of multiple deferred objects in jquery
问题 Below are my Multiple ajax calls with promises. $(window).load(function(){ $.when(getApiModemList()).done(function(vendors){ var deferreds = calculateApiBalances(vendors); $.when.apply($,deferreds).done(function(balance) { console.log(balance); console.log("All Done"); }); }); function getApiModemList(){ return $.getJSON("url"); } function calculateApiBalances(vendors) { var defer=[]; $.each(vendors,function(k,v){ defer.push($.getJSON(someurl)); }); return defer; } }); Function