First, the HTTP request method in Jquery
AJAX-related knowledge:
Global configuration of Ajax: Through the Ajaxsetup method, each AJAX request executes the configuration in the Ajaxsetup
Recommendation: You need to do the same for every Ajax request, this method is recommended
6 stages of an AJAX request
1. Ajaxstart () The first request begins: No matter how many AJAX requests, the code executes only once
2. Ajaxsend () Any one request sent, executed
3. Ajaxsuccess () Any request succeeds, execution
4. Ajaxcomplete () Any request completed, execution
5. Ajaxstop () The request is complete, execute: No matter how many AJAX requests, the code executes only once
6. Ajaxerror ()
Request Timeout settime: milliseconds; walk Error:function () {};
Cache (Default:true) is cached and may not be sent,
Send AJAX requests to avoid caching: "If you go to cache, you cannot send AJAX requests"
Method One: Add Cache:false in Ajax, the property will not load the request information from the browser cache, the default is true (when datatype is a script, the default is False).
Method two: url: '/api/teacher/profile?r= ' + math.random (),
Async Properties in Ajax
The default setting is true, and all requests are asynchronous requests.
Set a value of false to send a synchronization request note that the synchronization request will lock the browser, and the user's other actions must wait for the request to complete before it can be executed.
Second, Axios
- Promise-based HTTP request client that can be used in both the browser and node. js
Reference
Third, the similarities and differences between Jquery and Axios
HTTP Request Class Library