SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 178 | Next

Jonathan Snook, Aaron Gustafson, Stuart Langridge, and Dan Webb

"Accelerated DOM Scripting with Ajax, APIs, and Libraries"


The HTTP status code is accessed via the status attribute of the XHR object.
Finally, the onreadystatechange event handler was changed from the one that you had
originally passed in via the options object to the internal handler.
HTTP Status Codes
Whenever a browser makes a call, the server sends back a response. Within the response, a
status code is returned, letting the browser know some vital information. For an in-depth view
of all the possible status codes, check out the HTTP/1.1 recommendation from the W3C
(www.w3.org/Protocols/rfc2616/rfc2616-sec10.html).
What you hope to see is a status of 200, which indicates a successful response. Anything
within the 200 range is a success. A response in the 300 range is a redirection. The browser will
automatically handle the redirection and retrieve the new document, which should then
return the 200 response status. The 400 range is considered a client error. The request might
not have been sent correctly, or you asked for a page that doesn??™t exist??”that is, the dreaded
404! Last but not least, the 500 range indicates a server error of some sort. When it comes to
Ajax requests, you want a response only in the 200 range. The previous code examples already
did this by checking that the status was greater than or equal to 200 and less than 300.
if( !aborted && transport.status >= 200 && transport.status < 300 )
Multiple Requests
It??™s very likely that after you build an Ajax-enabled web site or application, you??™ll need to make
multiple requests.


Pages:
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6