I am trying to use the ajax function to assign the first task to the back end, and continue using another ajax function to assign the second job to the back end when the first task is done.
function fun1() {
$.ajax({
type:"POST",
async:false,
url: ...,
success:function() {
alert(0);
fun2();
alert(4);
}
});
}
function fun2() {
$.ajax({
type:"POST",
async:false,
url: ...,
success:function() {
alert(1);
fun3();
alert(3);
}
});
}
function fun3(){
alert(2);
}
I expected the alert result should be 0 1 2 3.
However, I got the result 0 4 1 2 3
async seems not work here. Can anyone know how to do that?
Thanks