我有这样的代码,
var deffereds = $(someArray).map(function(index, ele) {
return $.Deferred(function(def) {
//Do Some custom thing with ele here
def.resolve(someValue); //SomeValue will be differnt for each element
});
});
$.when.apply(null, deffereds.get()).then(function (r1,r2,...) { // <-- Here is the problem
//How Can I access responses from all the deffereds?
});
我的问题是如何访问所有延迟的响应?因为 someArray 中的项目数是动态的。