开发者

Using a Array of objects with $.when

I have Array of Ajax requests, the length of th开发者_开发问答is Array. When I know that they are all loaded I want to process the results

The code I'm using is

$.when(
    RequestArray        
).done(function(){
    this.processResults();
});

Does anyone have any ideas why it's not working?

When I replace RequestArray with RequestArray[0], RequestArray[1] it works perfectly.

Thank you


If you pass multiple requests to when you're supposed to put them in separate arguments, not to pass an array of requests. So, $.when.apply(RequestArray).done(...).


the $.when not accept a request array. you shoudl use $(requestArray).each($.when(this).done(......));

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜