gpt4 book ai didi

javascript - 如何在 jQuery when() 函数中传递 XHR 请求的动态列表?

转载 作者:行者123 更新时间:2023-11-30 18:08:43 30 4
gpt4 key购买 nike

我正在尝试使用 jQuery 的 when() 并传入 XHRRequest 的动态列表,但显然 when() 不支持数组作为其参数。

我该怎么做呢?

非常感谢任何帮助,谢谢!

最佳答案

这里的关键函数是apply() .

$.when.apply(null, arrayXHR).done(function(response1, response2, ....){ 
console.log(response1, response2 ...);
});

关于javascript - 如何在 jQuery when() 函数中传递 XHR 请求的动态列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15148070/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com