[Ajax] XMLHttpRequest-readystate-status

Source: Internet
Author: User
Document directory
  • Readystate
  • Status
Readystate

HTTP Request status. When an XMLHttpRequest is created for the first time, the value of this attribute starts from 0 until the complete HTTP response is received. This value is increased to 4.

Each of the five States has an associated informal name. The following table lists the status, name, and meaning:

Status Name Description
0 Uninitialized Initialization status. The XMLHTTPRequest object has been created or reset by the abort () method.
1 Open The open () method has been called, but the send () method has not been called. The request has not been sent.
2 Send The send () method has been called and the HTTP request has been sent to the web server. No response is received.
3 Processing ing All Response Headers have been received. The response body starts receiving but is not completed.
4 Loaded The HTTP response has been fully received.

The value of readystate will not decrease unless a request calls the abort () or open () method during processing. The onreadystatechange event handle is triggered every time the value of this attribute is increased.

Status

The HTTP status code returned by the server. For example, 200 indicates success, and 404 indicates "not found" error. When readystate is less than 3, reading this attribute will cause an exception.

1xx: Information

Message: Description:
100 continue The server only receives some requests, but once the server does not reject the request, the client should continue to send other requests.
101 switching protocols Server conversion protocol: the server converts client-compliant requests to another protocol.
2XX: Successful
Message: Description:
200 OK The request is successful (followed by the response document to the get and post requests .)
201 created The request is created and a new resource is created.
202 accepted The request for processing has been accepted but not completed.
203 non-authoritative information The document has been returned normally, but some response headers may be incorrect because the document is copied.
204 NO content No new document. The browser should continue to display the original document. This status code is useful if the user regularly refreshes the page and the servlet can determine that the user document is new enough.
205 reset content No new document. But the browser should reset the content it shows. Used to force the browser to clear the input content of the form.
206 partial content The client sends a GET request with a range header, and the server completes the request.
3xx: Redirection
Message: Description:
300 multiple choices Multiple options. Link List. You can select a link to reach your destination. Up to five addresses are allowed.
301 moved permanently The requested page has been transferred to the new URL.
302 found The requested page has been temporarily transferred to the new URL.
303 see other The requested page can be found under another URL.
304 not modified The document was not modified as expected. The client has a buffered document and sends a conditional request (generally, the IF-modified-since header is provided to indicate that the customer only wants to update the document on a specified date ). The server tells the customer that the original buffer documentation can still be used.
305 use proxy The document requested by the customer should be extracted from the proxy server specified by the location header.
306Unused This code is used in the previous version. It is no longer used, but the code is still retained.
307 temporary redirect The requested page has been temporarily moved to the new URL.
4xx: client Error
Message: Description:
400 bad request The server does not understand the request.
401 unauthorized The user name and password are required for the requested page.
402 payment required This code is not available yet.
403 Forbidden Access to the requested page is forbidden.
404 not found The server cannot find the requested page.
405 method not allowed The method specified in the request is not allowed.
406 not acceptable The response generated by the server cannot be accepted by the client.
407 proxy authentication required The user must first use the proxy server for authentication so that the request will be processed.
408 request timeout The request exceeds the server wait time.
409 conflict The request cannot be completed due to a conflict.
410 gone The requested page is unavailable.
411 length required "Content-Length" is not defined. If no such content exists, the server will not accept the request.
412 precondition failed The request's prerequisites are evaluated as failed by the server.
413 Request Entity too large Because the requested entity is too large, the server will not accept the request.
414 request-URL too long Because the URL is too long, the server will not accept the request. This happens when a POST request is converted to a GET request with a long query information.
415 unsupported media type Because the media type is not supported, the server does not accept the request.
416 The server cannot meet the range header specified by the customer in the request.
417 expectation failed
5xx: Server Error
Message: Description:
500 Internal Server Error The request has not been completed. Unpredictable server conditions.
501 not implemented The request has not been completed. The server does not support the requested functions.
502 Bad Gateway The request has not been completed. The server receives an invalid response from the upstream server.
503 service unavailable The request has not been completed. Temporary server overload or Server Load balancer.
504 gateway timeout The gateway times out.
505 HTTP Version Not Supported The server does not support the HTTP protocol version specified in the request.
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.