<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>
normally, the ajax, in task01 should be executed first, and then why does ajax, in Promise.all () execute Promise.all () first and then ajax in task01