(修改了很多,因为它是一类等等等等的一部分。)
(Modified a lot, as it's part of a class etc etc.)
目前,这感觉有点hackish,作为定时器的使用似乎垃圾。我会用$。当和$ .done,但我不知道有多少间可能有,所以我不知道该怎么投入的时候。
At the moment this feels a bit hackish, as the timer usage seems rubbish. I would use $.when and $.done, but I don't know how many rooms there might be, so I don't know what to put into when.
如何在AJAX请求我保证run_the_rest_of_the_app()仅被调用一次全部回来了?
How do I ensure that run_the_rest_of_the_app() only gets called once all of the AJAX requests come back?
推荐答案-
VAR activeAJAX = 0;
在做一个AJAX调用 activeAJAX ++;
Before making an AJAX call, activeAJAX++;
在完成一个AJAX调用(回调)后:如果(--activeAJAX == 0){allDone(); }
After completing an AJAX call (in the callback): if (--activeAJAX == 0) { allDone(); }
更多推荐
多个Ajax请求烧成后回调完成
发布评论