Ajax method summary: ajax method summary

Source: Internet
Author: User

Ajax method summary: ajax method summary
1. Native ajax

Difference between get requests and post requests: small yellow triangle

Take the get request as an example. The output result is as follows:

2. ajax in jquery

The following six common methods are listed:

3. Status description

Readystate:

0: the request is not initialized and open is not called.

1: The server connection has been established and open has been called.

2: The request has been accepted, that is, the received header information.

3: The request is being processed, that is, the response body is received.

4: The request is complete and the response is ready, that is, the response is complete.

Http status code:

200: OK everything is normal. The response document to the GET and POST requests follows

301: Moved Permanently the document requested by the customer is elsewhere. The new URL is provided in the Location header and the browser should automatically access the new URL.

302: Found is similar to 301, but the new URL should be treated as a temporary alternative, rather than permanent.

304: Not Modified the client has a buffered document and issued a conditional request (generally, the If-Modified-Since header is provided to indicate that the customer only wants to update the document later than the specified date ). The server tells the customer that the original buffer documentation can still be used.

307: Temporary Redirect and 302 (Found) are the same. Many browsers mistakenly respond to the 302 response for redirection. Even if the original request is POST, it can only be redirected when the POST request actually responds to 303. For this reason, HTTP 1.1 adds 307 to clear the region code in several states: When a 303 response occurs, the browser can follow the redirected GET and POST requests; if a 307 response occurs, the browser can only follow the redirection to get requests.

400: syntax error occurs in Bad Request requests.

401: Unauthorized the customer attempted to access the password-protected page without authorization. The response contains a WWW-Authenticate header. the browser displays the username/password dialog box accordingly, and then sends a request again after entering the appropriate Authorization header.

403: Forbidden resources are unavailable.

404: Not Found cannot find the resource at the specified position

410: the document requested by Gone is no longer available, and the server does not know which address to redirect. It differs from 404 in that if 407 is returned, the document permanently leaves the specified position, and 404 indicates that the document is unavailable for unknown reasons.

500: the Internal Server Error Server encounters unexpected circumstances and cannot complete the customer's request

501: The Not Implemented server does Not support the functions required to implement the request. For example, the customer sends a PUT request not supported by the server.

 

Related Article

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.