Async defaults to True, which is asynchronous, that is, when Ajax sends a request, in the process of waiting for the server to return, the foreground will continue executing the script behind the AJAX block until the server side returns the correct result to execute the success. That is to say that this time the execution is two threads, the AJAX block makes the request after a thread and the AJAX block behind the script (another thread) example:
$.ajax ({
type: "POST",
URL: "Venue.aspx?act=init",
dataType: "html",
success:function (Result) { //function1 ()
F1 ();
F2 ();
}
Failure:function (Result) {
alert (' Failed ');
},
}
function2 ();
In the example above, when the Ajax block makes a request, he will stay function1 (), waiting for the server side to return, but at the same time (during this wait), the foreground will go to execute function2 (), that is, at this time two threads appear, For the moment we say Function1 () and function2 ().
When the ASYCN is set to False, then the AJAX request is synchronized, that is, when the AJAX block makes the request, he will wait in the function1 () this place, not to execute function2 (), until the function1 () part of the execution is complete.
Note: Method F1 () in success, F2 () general (i.e. F1 (), F2 () Excluding Ajax blocks) does not execute asynchronously, meaning that the execution of F2 is premised on F1 ().