1. Native Ajax
difference between get request and POST request: yellow small triangle
Take the GET request as an example, the output is as follows:
Ajax in the 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 called the
2: Request accepted, that is to receive the end of information
3: Request processing, that is, received the response body
4: The request is complete and the response is ready, that is, the response is complete
HTTP status code:
OK Everything is fine, the answer document for Get and post requests follows
moved Permanently client-requested document 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 alternative, not permanent.
304: Not Modified the client has a buffered document and makes a conditional request (typically provides a if-modified-since header indicating that the customer only wants to update the document for a specified date). The server tells the customer that the previously buffered document can continue to be used.
307: Temporary Redirect and 302 (Found) are the same. Many browsers incorrectly respond to 302 responses for redirection, even if the original request is post, even if it is actually only redirected when the POST request is answered at 303. For this reason, HTTP 1.1 has been added 307 to further clear the locale code: when a 303 reply occurs, the browser can follow the redirected get and post requests, and if 307 answers, the browser can only follow the redirection of the got request.
Bad Request a syntax error occurred.
401: Unauthorized customer is trying to access a password-protected page without authorization. A www-authenticate header is included in the answer, the browser displays the user name/password dialog Accordingly, and then makes the request again after filling in the appropriate authorization header.
403: Forbidden Resource is not available.
404: Not Found cannot find the resource at the specified location
410: Gone The requested document is no longer available and the server does not know which address should be redirected to. It differs from 404 in that the return of 407 indicates that the document left the specified location permanently, while 404 indicates that the document is not available because of an unknown reason.
Internal Server Error Server encountered unexpected situation, unable to complete customer's request
501: Not implemented server does not support the functionality required to implement the request. For example, the customer issued a put request that the server does not support
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring some help, but also hope that a lot of support cloud Habitat community!