Summary of Ajax methods

Source: Internet
Author: User

1. Native Ajax

Get request differs from POST request: yellow triangle

Take the GET request as an example, the output is as follows:

Ajax in 2.jquery

The 6 commonly used methods are listed:

3. Status Description

ReadyState

0: Request not initialized, open not called

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

2: The request has been accepted, that is to receive the header information

3: The request is 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 OK, answer documents for Get and post requests follow the back

301:moved permanently The document requested by the customer elsewhere, the new URL is given 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 replacement, not a permanent.

The 304:not Modified client has a buffered document and issues a conditional request (typically providing a if-modified-since header indicating that the customer only wants to update the document than the specified date). The server tells the customer that the original buffered document can continue to be used.

307:temporary Redirect and 302 (Found) are the same. Many browsers incorrectly respond to a 302 response for redirection, even if the original request is post, even though it can actually be redirected only if the answer to the POST request is 303. For this reason, HTTP 1.1 has been added in 307 to allow for more cleanup of the region in several status codes: When a 303 response occurs, the browser can follow the redirected get and post requests, and if the 307 answer, the browser can only follow the redirect to the GET request.

400:bad request syntax error occurred.

401:unauthorized customer attempts to access password-protected pages without authorization. A www-authenticate header is included in the answer, and the browser displays the user name/Password dialog box, and then makes a request again after filling in the appropriate authorization header.

403:forbidden resource is not available.

404:not Found cannot find a resource at the specified location

The document requested by 410:gone is no longer available, and the server does not know which address to redirect to. It differs from 404 in that returning 407 means that the document has permanently left the specified location, and 404 indicates that the document is unavailable for unknown reasons.

500:internal Server Error Server encountered unexpected situation, unable to complete customer request

The 501:not implemented server does not support the functionality required to implement the request. For example, a customer issues a put request that is not supported by the server

Forward

Summary of Ajax methods

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.