您可以为同时运行的AJAX调用和其他代码提供相同的回调,使用变量来跟踪它们的组合进度,然后将它们链接到如下所示的回调:
// Each time you start a call, increment this by onevar counter = 0;var callback = function() { counter--; if (counter == 0) { // Execute pre you wanted to do once both threads are finished. }}


