<分区>
我有一个需要未定义时间才能完成的 Java Script 函数。在一个循环中,我想等到函数完成,然后等待定义的时间(例如 5000 毫秒)并再次调用该函数。我如何在 Java Script 中完成此操作?
基本上我想要这个:
call function and wait until it is finished
wait another 5000 seconds
call function and wait until it is finished
wait another 5000 seconds
...
函数本身看起来像这样:
for every group in list
.ajax(delete group items; get group items; add group items)
我目前遇到的问题是,在循环的中间,函数以某种方式再次被调用。