AJAX request status return status list of the five state readyState

ReadyState of the five states for a description or definition, a lot of Ajax Books (English original) and most did not elaborate on "Pragmatic Ajax A Web 2.0 Primer" in the state happened to see the introduction of readyStae, feeling this introduction is really ... ...
Ideally, interpretation should be based on "state: task (target) + process + performance (or features)" the expression pattern of several states to be defined in this

【Full】

In "Pragmatic Ajax A Web 2.0 Primer" in the state happened to see the introduction of readyStae, very real feeling that the introduction, summary translation is as follows:

0: (Uninitialized) the send () method has not yet been invoked.
1: (Loading) the send () method has been invoked, request in progress.
2: (Loaded) the send () method has completed, entire response received.
3: (Interactive) the response is being parsed.
4: (Completed) the response has been parsed, is ready for harvesting.

0 - (not initialize) do not call the send () method
1 - (loaded) have called send () method, is to send a request
2 - (Loaded) send () method has completed, entire response has been received
3 - (interactive) is to parse the response content
4 - (complete) response to the content analysis is complete, you call the client

In "Understanding AJAX: Using JavaScript to Create Rich Internet Applications" in the following table illustrates this:
Table 1. ReadyState Levels readyState Status Code
Status of the XMLHttpRequest Object

(0) UNINITIALIZED
Uninitialized
The object has been created but not initialized. (The open method has not been called.)
(XMLHttpRequest) object has been created but not initialized (no call to open method.)

(1) LOADING
Loading
The object has been created, but the send method has not been called.
(XMLHttpRequest) object has been created, but the send method has not been called.

(2) LOADED
Finished loading
The send method has been called, but the status and headers are not yet available.
Send method has been called, (HTTP response) state and the head is not available.

(3) INTERACTIVE
Interaction
Some data has been received. Calling the responseBody and responseText properties at this state to obtain partial results will return an error, because status and response headers are not fully available.
Part of the data has been received. However, if the call at this time and the responseText property to get some responseBody results will generate an error because the state and the response of the head is not fully available.

(4) COMPLETED
Complete
All the data has been received, and the complete data is available in the responseBody and responseText properties.
Has received all the data, and in responseBody and responseText properties can be extracted to the complete data.

Based on the above books in five states on the readyState introduction, I think it was "Pragmatic Ajax A Web 2.0 Primer" relatively in place, since it refers to the received data analysis issues, other books do not mention this point, and this is the "(3) interactive" stage as a necessary conversion process exists in the "(2) finished loading" to "(4) completed" between the grounds, that is, what its mandate. To sum up, I think the ideal interpretation should be "state: task (target) + process + performance (or features)," this expression pattern to a more precise definition of several state and makes it easier to understand. Is again summarized as follows:

Table 2. ReadyState status status status readyState Detailed Description

(0) is not initialized at this stage confirm the XMLHttpRequest object is created, and call open () method of preparation is not initialize. Value of 0 indicates an object already exists, otherwise the browser will error - object does not exist.

(1) on the XMLHttpRequest object to load the initialization phase, which calls open () method, according to the parameters (method, url, true) complete the set state of the object. And call the send () method sends the request to the service began. Value of 1 means the request is sent to the server.

(2) loading the server to complete this stage of receiving the response data. But just get the raw data server response, and not directly on the client. 2 said that it has received full value for the Department of response data. And data analysis for the next stage of its preparation.

(3) The interaction of this phase of server-side parsing the received response data. That is based on the server response headers returned MIME type to convert data through responseBody, responseText or responseXML property access format for the call to prepare for the client. State 3 represents the data being parsed.

(4) to complete this stage of analysis confirmed that all the data have been available for the client format, resolution has been completed. 4 that data analysis is completed, you can get the corresponding property of XMLHttpRequest object data.

Which includes almost the entire life cycle of XMLHttpRequest object should contain the following phases:
Create - Initialization request - send request - receive data - Analysis of data - completed

In specific applications, the five states defined readyState (XMLHttpRequest object in all stages of the life cycle) the meaning of the core can eliminate the mystery of Ajax (behind either did not elaborate trick to create a sense of mystery; or is "in its intoxication, people Visible "), quickly grasp its essence, learning to reduce frustration and enhance self-confidence is extremely useful.

For example, by the following example:

AJAX requests to a remote file, or a remote file is dropped in the test chain, will need to know the status of the remote server to determine the feedback file exists or not.
Of course, we usually visit the website, it will also find some files do not exist is displayed as "404", which is a common Http request status (status)
Web server response browser or other client's request, the response generally consists of the following components: a status line, some response headers, a blank line, the contents of the document. Here is a simple answer:
The status line contains the HTTP version, status code, and a brief description of the corresponding status code information. In most cases, in addition to all other than Content-Type response header is optional. But the Content-Type is required, it is the back of the document describes the MIME type. Although most responses contain a document, but some do not contain, for example, the response of HEAD request for documents never came. In fact many of the state code used to identify a failed request, the response does not contain a document (or only error message that contains a brief description).
When a user tries to access a running HTTP Internet Information Services (IIS) content on a server, IIS returns a status of the request, said the number of code. The specific status code can indicate whether the request has been successful, the request can also reveal the exact cause of failure.

1xx - Information suggesting that these status codes indicate a provisional response. Response to the client prior to receiving regular, should be prepared to receive one or more 1xx responses.
· 100 - Continue the initial request has been accepted, the client should continue sending the rest of the request. (HTTP 1.1 new)
· 101 - Switching Protocols server will comply with the requests of customers to switch to another protocol (HTTP 1.1 new)

2xx - success of such a status code that the server successfully accepted the client request.
· 200 - OK everything is normal, GET and POST requests on the response document followed.
· 201 - Created server has created the document, Location header given its URL.
· 202 - Accepted request has been accepted, but the deal has not been completed.
· 203 - Non-Authoritative Information document has been properly returned, but some of the first response may not be correct, because using a copy of the document, non-authoritative information (HTTP 1.1 new).
· 204 - No Content is not a new document, the browser should continue to show the original document. If you refresh the page regularly, and Servlet enough to determine a new user documentation, the status code is very useful.
· 205 - Reset Content is no new content, but the browser displays the contents of it should be reset. Used to force the browser to clear the form input (HTTP 1.1 new).
· 206 - Partial Content client sends a GET request with Range header, the server completed its (HTTP 1.1 new).

3xx - Redirection The client browser must take more action to fulfill the request. For example, the browser may have to request a different page on the server, or through a proxy server to repeat the request.
· 300 - Multiple Choices client requests a document can be found in multiple locations, these locations have been listed in the returned document. If you prefer to ask the server, it should be specified in the Location response header.
· 301 - Moved Permanently customers in other parts of the requested documents, the new URL given in the Location header, the browser should automatically access the new URL.
· 302 - Found similar to the 301, but the new URL should be viewed as a temporary replacement, not permanent. Note that in HTTP1.0 corresponding state information is "Moved Temporatily". This status code appears, the browser can automatically access the new URL, so it is a useful status code. Note that this status code 301 can be used interchangeably at times. For example, if the browser request incorrectly http://host/ ~ user (after the slash is missing), some server returns 301, while others return to 302. Strictly speaking, we can only assume that only when the original request is GET the browser will automatically redirect. See 307.
· 303 - See Other similar to the 301/302, the only difference is that, if the original request was POST, Location header specifies the target document should be redirected extracted by GET (HTTP 1.1 new).
· 304 - Not Modified documentation for the client has a buffer and sends a conditional request (usually available If-Modified-Since header that customers want to update the document than the specified date.) Server tell the client, the original buffer can continue to use the document.
· 305 - Use Proxy client requests the document should be specified in the head by Location extract proxy server (HTTP 1.1 new).
· 307 - Temporary Redirect and 302 (Found) the same. Many browsers will incorrectly respond to 302 redirect response, even if the original request was POST, even if it is actually only in POST requests only when the response is a 303 redirect. For this reason, HTTP 1.1 added 307 for more clearance areas in several states code: When a 303 response, the browser can follow the redirection of GET and POST requests; If the answer is 307, the browser can only follow redirection of GET requests. (HTTP 1.1 new)

4xx - Client Error An error occurred, the client seems to have problems. For example, the client requests a page does not exist, the client does not provide valid authentication information.
· 400 - Bad Request request syntax error.
· 401 - Unauthorized Access is denied, the client attempts to gain unauthorized access to password-protected pages. The response will include a WWW-Authenticate header, the browser displays the user accordingly Name / Password dialog box, then fill in again after a suitable Authorization header request. IIS defines a number of different 401 errors that indicate a more specific cause of the error. These specific error code is displayed in the browser, but not in IIS log:
* 401.1 - Logon failed.
* 401.2 - Logon failed due to server configuration.
* 401.3 - Due to ACL on resource constraints without authorization.
* 401.4 - Authorization failed by filter.
· 401.5 - ISAPI / CGI application authorization failure.
* 401.7 - Access Web URL authorization policy on the server rejected. This error code is specific to IIS 6.0.
· 403 - Forbidden resources are not available. Server understands the customer's request, but refused to deal with it. Usually due to files on the server or the directory permissions set lead. Forbidden: IIS defines a number of different 403 errors that indicate a more specific cause of the error:
* 403.1 - Execute access forbidden.
* 403.2 - Read access forbidden.
* 403.3 - Write access forbidden.
* 403.4 - requires SSL.
* 403.5 - requires SSL 128.
· 403.6 - IP address to be rejected.
* 403.7 - Client certificate required.
* 403.8 - Site access denied.
* 403.9 - Too many users.
* 403.10 - configuration is invalid.
* 403.11 - Password change.
* 403.12 - Mapper denied access table.
* 403.13 - Client certificate revoked.
* 403.14 - Directory listing denied.
* 403.15 - Client Access Licenses exceeded.
* 403.16 - Client certificate is untrusted or invalid.
* 403.17 - Client certificate has expired or not yet valid.
* 403.18 - in the current application pool can not perform the requested URL. This error code is specific to IIS 6.0.
* 403.19 - not the application pool for the implementation of the client CGI. This error code is specific to IIS 6.0.
· 403.20 - Passport logon failed. This error code is specific to IIS 6.0.
· 404 - Not Found can not find the specified location of the resource. It is also a common response.
* 404.0 - (None) - File or directory not found.
* 404.1 - can not access the requested Web site port.
· 404.2 - Web service extension lockdown policy prevents this request.
· 404.3 - MIME map policy prevents this request.
· 405 - Method Not Allowed request methods (GET, POST, HEAD, Delete, PUT, TRACE, etc.) on the specified resource does not apply to access this page HTTP verb is not allowed (method not allowed) (HTTP 1.1 new )
· 406 - Not Acceptable specified resource has been found, but it's MIME types and customers Accpet specified header is not compatible, the client browser does not accept the MIME type of the requested page (HTTP 1.1 new).
· 407 - Proxy Authentication Required Proxy authentication required, similar to the 401 that customers must be authorized by the proxy server. (HTTP 1.1 new)
· 408 - Request Timeout waiting time permitted in the server, the client has not issued any request. Customers can later repeat the same request. (HTTP 1.1 new)
· 409 - Conflict and PUT requests are usually related. Since the current state of the request and resource conflicts, so the request can not be successful. (HTTP 1.1 new)
· 410 - Gone the requested document is no longer available, but the server does not know where an address redirect. The difference between it and the 404, 407 that the document returned permanently left the specified location, and 404 for an unknown reason the document is not available. (HTTP 1.1 new)
· 411 - Length Required server can not process the request, unless the client sends a Content-Length header. (HTTP 1.1 new)
· 412 - Precondition Failed request headers some conditions specified in the failed (HTTP 1.1 new).
· 413 - Request Entity Too Large target document larger than the server is willing to deal with the current size. If the server that they can later deal with the request, should provide a Retry-After header (HTTP 1.1 new).
· 414 - Request URI Too Long URI too long (HTTP 1.1 new).
* 415 - Unsupported media type.
· 416 - Requested Range Not Satisfiable server can not satisfy the customers in the Range specified in the request header. (HTTP 1.1 new)
* 417 - Execution failed.
* 423 - Locked error.

5xx - Server Error The server encountered an error and can not be completed because the request.
· 500 - Internal Server Error The server encountered an unexpected situation, can not complete the customer's request.
* 500.12 - Application is busy restarting the Web server.
· 500.13 - Web server is too busy.
* 500.15 - do not allow direct request Global.asa.
· 500.16 - UNC authorization credentials incorrect. This error code is specific to IIS 6.0.
· 500.18 - URL authorization store can not be opened. This error code is specific to IIS 6.0.
* 500.100 - Internal ASP error.
· 501 - Not Implemented server does not support the functionality required to fulfill the request, the header value specifies the configuration is not implemented. For example, the client sends a server does not support the PUT request.
· 502 - Bad Gateway server as a gateway or proxy, in order to complete the requested access to the next server, but the server returned an invalid response. Also said that the Web server as a gateway or proxy server received an invalid response.
· 502.1 - CGI application timeout.
· 502.2 - CGI application error.
· 503 - Service Unavailable Service is not available, the server failed to answer due to maintenance or overloading. For example, Servlet database connection pool is full may be the case back 503. When the server returns a 503 Retry-After header. This error code is specific to IIS 6.0.
· 504 - Gateway Timeout Gateway timeouts from the server as a proxy or gateway to use, that they can not get a timely response from the remote server. (HTTP 1.1 new).
· 505 - HTTP Version Not Supported The server does not support the specified HTTP request version. (HTTP 1.1 new).

分类:Web 时间:2010-12-14 人气:270
分享到:
blog comments powered by Disqus

相关文章

  • AJAX XMLHttpRequest object of acquaintance. Txt 2010-08-29

    AJAX The XMLHttpRequest object /*********************************** acquaintance ******** ************************/ AJAX XMLHttpRequest object is present for all Web 2.0 applications and technology base. Although the software vendor and open source c

  • Use of jQuery, Part 3: Using jQuery and Ajax Building Rich Internet Applications 2010-04-23

    Effects and Ajax ( Reprinted from ) <script type="text/javascript"> </ script> <noscript> </ noscript> <noscript> </ noscript> Sample code English original <! - START RESERVED FOR FUTURE USE INCLUDE FILES -

  • AJAX XMLHTTPRequest object for asynchronous data exchange 2010-07-03

    <html> <head><title>Simple jsp page</title> <script type="text/javascript" src="js/verify.js"></script> </head> <body> <input type="text"><br> <input type="b

  • AJAX - XMLHttpRequest Object Browser Support 2010-12-03

    AJAX is the XMLHttpRequest object points. Create a different browser XMLHttpRequest object is different. IE browser uses the ActiveXObject, while other browsers use the name The built-in JavaScript XMLHttpRequest object. For a different browser to cr

  • Comprehensive analysis of the XMLHttpRequest object 2010-04-02

    AJAX XMLHttpRequest object is present for all Web 2.0 applications and technology base. Although the software vendor and open source community are now providing AJAX framework in order to further simplify the use of XMLHttpRequest object; but we are

  • Comprehensive analysis of the XMLHttpRequest object (change) 2010-04-13

    AJAX XMLHttpRequest object is present for all Web 2.0 applications and technology base. Although the software vendor and open source community are now providing AJAX framework in order to further simplify the use of XMLHttpRequest object; but we are

  • XMLHttpRequest object 2010-12-24

    XMLHttpRequest object is used to exchange data with the server in the background. What is the XMLHttpRequest object? XMLHttpRequest object is used to exchange data with the server in the background. XMLHttpRequest object is the developer's dream, bec

  • AJAX request status return status list 2010-06-24

    AJAX request status return status list of the five state 2010-03-04 18:24 readyState readyState of the five states for a description or definition, a lot of Ajax Books (English original), the majority did not elaborate in the "Pragmatic Ajax A Web 2.

  • Ajax and the XMLHttpRequest object 2009-03-13

    XMLHttpRequest object components are XMLHttp through this object, Ajax can be the same as desktop applications with the server only the exchange of data layers without having to refresh every time interface, the data do not have to deal with each of

iOS 开发

Android 开发

Python 开发

JAVA 开发

开发语言

PHP 开发

Ruby 开发

搜索

前端开发

数据库

开发工具

开放平台

Javascript 开发

.NET 开发

云计算

服务器

Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.290 (s). 12 q(s)