Execution order of success and complete in jquery ajax

http://blog.sina.com.cn/s/blog_4adc4b090101dhnh.html

https://q.cnblogs.com/q/21810/

******************************************************************

The order of execution of each event in jquery is as follows:

1.ajaxStart (global event)

2.beforeSend

3.ajaxSend (global event)

4.success

5.ajaxSuccess (global event)

6.error

7.ajaxError (global event)

8.complete

9.ajaxComplete (global event)

10.ajaxStop (global event)

First execute success, then execute error, and finally execute complete

----------------------

The difference is--- 

success: The function is called when the request is successful, ie status==200;

complete: The function is called when the request is completed, that is, status==404, 403, 302... As long as there is no error.

 

Because usually we need to clean up resources, so it is designed to execute compelete after success 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325775716&siteId=291194637