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 141 | Next

Thomas Powell

"Ajax: The Complete Reference"

You can prove this to yourself by trying to run the example at
http://ajaxref.com/ch3/longprocess.html, but given the difficulty in forcing the issue you
might rather watch a movie that shows this situation in action at http://ajaxref.com/ch3/
longprocessmovie.html.
90 Par t I : C o r e I d e a s
With the increased interest in JavaScript from Ajax, we may see the eventual introduction
of thread control or features like continuations that may allow for a more suspend-interruptcontinue
style of coding. For the moment, however, you should be mindful that you may
have to wait to get your data until your browser has a moment to deal with it.
status and statusText
After the readyState value has indicated that some headers have been received, the next
step is to look at the success or failure of the response by looking at the XHR??™s status and
statusText properties. The status property will contain the numeric HTTP status value such
as 200, 404, 500, and so on, while the statusText property will contain the corresponding
message or reason text like ???OK???, ???Not Found???, ???Unavailable???, ???No Data???, and so on.
Very often, the use of these values in Ajax applications is a bit rudimentary, usually
looking to make sure that the XHR??™s response status value is 200 (as in 200 OK) and in all
other cases failing, like so:
function handleResponse(xhr)
{
if (xhr.


Pages:
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153