雏菊链$.get是如何像这样调用的:
let data1;
let data2;
$.get(data1URL).done((data) => {
data1 = data;
secondCall();
}).catch(error => console.log(error));
function secondCall() {
$.get(data2URL).done((data) => {
data2 = data;
buildPage();
}).catch(error => console.log(error));
}
function buildPage() {
console.log(data1);
console.log(data2);
}发布于 2020-10-02 21:49:31
您可以使用jQuery.when方法。
$.when( $.ajax( "/page1.php" ), $.ajax( "/page2.php" ) )
.then( myFunc, myFailure );https://stackoverflow.com/questions/64178522
复制相似问题