9
将一个Deferreds数组传递给$ .when()
这是正在发生的事情的一个虚构示例:http : //jsfiddle.net/adamjford/YNGcm/20/ HTML: <a href="#">Click me!</a> <div></div> JavaScript: function getSomeDeferredStuff() { var deferreds = []; var i = 1; for (i = 1; i <= 10; i++) { var count = i; deferreds.push( $.post('/echo/html/', { html: "<p>Task #" + count + " complete.", delay: count }).success(function(data) { $("div").append(data); })); …