Ajax is performed asynchronously by default, that is, its properties Async:boolean (asynchronous);
The difference between synchronous and asynchronous:
Synchronization: Client requests data to the server until that part of the data is returned, the corresponding program queue of the client after requesting the return value is executed sequentially, during which the client is in suspended animation;
Async: Cilent requests data to the server, Cilent is active, the program queue continues to execute, and the corresponding cilent response is inserted into the program sequence after the server returns the data.
Eg:a,b[cilent sends a request to the server],c[server returns the request result],d,e to the client (where A,d,e is the client program executed sequentially);
Synchronization process: A--B--C--D--E; D will be executed after C, exactly in order;
Asynchronous process: A--B--D--E--c (possible result); After B sends the request execution, D does not wait, but directly after B executes, C's result return may after D, may also before D, is after has the result to insert the program queue;
Therefore, it is recommended to use synchronous mode when it comes to other program queues in cilent that may use server data that is requested by Ajax, because using async might have the server data in the queue other programs, and that data is still returned, resulting in undefined undefine errors.
Ajax Synchronous and asynchronous