【发布时间】:2019-07-08 08:17:24
【问题描述】:
我有这个代码。
$.getJSON("/some-path.json",function(resultArray){
for (var j = resultArray.length - 1; j >= 0; j--){
$.getJSON(resultArray[j],function(resultObject){
// Bunch of stuff happens here
});
}
}).done(function(){
// This should execute only after ALL $.getJSON codes above finish
});
但是.done() 中的代码在所有.getJSON() 内容完成之前运行。我如何让.done() 中的代码在.getJSON() 内容完成后执行?
【问题讨论】:
标签: javascript jquery getjson