<script>
const url="http://127.0.0.1/index.php?id=";
let task = [];
let task01 = function(){
return new Promise( function(resolve , reject){
$.ajax({
url: url+1,
context: document.body,
success: function(){
resolve('success');
console.log("01");
}
});
})
}
task[0]= new Promise( function(resolve , reject){
$.ajax({
url: url+2,
context: document.body,
success: function(){
resolve('success');
console.log("02");
}
});
})
task[1] = new Promise( function(resolve , reject){
$.ajax({
url: url+3,
context: document.body,
success: function(){
resolve('success');
console.log("03");
}
});
})
task01().then(function(value){
Promise.all(task);
})
</script>
先后顺序
梵蒂冈之花