作者:可菲儿2702934224 | 来源:互联网 | 2023-07-23 11:32
Imcurrentlycreatinganupdatescript,wherebyIhavealistoftaskseachdetailedinaUL,examp
I'm currently creating an update script, whereby I have a list of tasks each detailed in a UL, example below:
我正在创建一个更新脚本,我在其中列出了每个在UL中详细说明的任务,例如:
- Task one
- Task two
- Task three
I'm looking for a way for jQuery to systematically loop through each li and perform an AJAX request for each specific ID. More specifically, I'd like to do this automatically (without user interaction) performing each individual request in order... e.g when li#1 is finished, it'll start on the next.
我正在寻找一种让jQuery系统地遍历每个li并为每个特定ID执行AJAX请求的方法。更具体地说,我想自动执行此操作(无需用户交互)按顺序执行每个单独的请求...例如,当li#1完成时,它将从下一个开始。
I can loop through each li by using the following, but I can't see to get the AJAX to automatically perform its request
我可以通过使用以下方法遍历每个li,但我看不到让AJAX自动执行其请求
$('li').each(function(index) { task = $(this).attr('id'); /* perform the task */ });
Can anyone help?
有人可以帮忙吗?
3 个解决方案