HTTP Request Class Library

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.