後如何爲循環延遲,直到功能「some_multi_ajax_function()」如何執行第二循環迭代改變全局變量(exe_counter爲0)?AJAX做
for (i = 0; i < some_data_list.length; i++) {
exe_counter=1;
if(i>0 && exe_counter != 0){
delay{
// delay for loop until some_multi_ajax_function() set exe_counter = 0
// do not execute second iteration
}
}else{
data = some_data_list[i];
// Many ajax posts will be executed here. In the end exe_counter will be set to 0;
some_multi_ajax_function(data);
}
}
function some_multi_ajax_function(data){
$.ajax({
...
}.done(function(d) {
// here it could be used another ajax function
exe_counter = 0;
});
}
你的腳本應該做的是什麼呢? – 2015-02-06 14:20:54
通過座標搜索廣告,協調從谷歌API獲取。它可以掃描10次 – 2015-02-06 14:47:12