Home arrow AJAX & Prototype arrow Page 2 - How to Handle Ajax Errors

Server or Transmission Line is not functioning - AJAX

An Ajax request behaves like a JavaScript thread. While the request is going on, execution of the JavaScript code in the flow of the code carries on. How do you solve possible conflicts and the resulting errors?

TABLE OF CONTENTS:
  1. How to Handle Ajax Errors
  2. Server or Transmission Line is not functioning
  3. HTTP Status
  4. Thread effect of Ajax Request
By: Chrysanthus Forcha
Rating: starstarstarstarstar / 8
January 21, 2009

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
 

I can only give you my experience here. If the server or the transmission lines stop functioning after the user sees his web page on the screen, no Ajax text or error message will be downloaded. Nothing would come in place of the Ajax text. Now, what I have said here is my experience. 

Server script does not function 

It is possible for you to write a script that does not function at the server. I am talking here about the script that has to send the Ajax text from the server to the client. If the script is not functioning, and everything else is functioning, you will definitely not have the downloaded Ajax text. However, the server may send an error message in place of the Ajax text. The user would then see the error message instead of the Ajax text. The best way to avoid this is to make sure that your script does not have errors.

The readyState property of the JavaScript Ajax object  

The "readyState" property keeps track of the current stage of the request by returning an integer. The readyState property of the JavaScript Ajax object can have the value 1, or 2, or 3, or 4. The meanings of these values are as follows: 

0: uninitialized

1: loading

2: loaded

3: interactive

4: complete  

The value to always use is the last one, which indicates that the download has been completed. See the illustration in the Ajax code above. The question is, “can any of these values be used to check errors?” The answer is no. You cannot use any of these values to determine whether an error has occurred. You can use these values just to check which stage the response of the request has reached.



 
 
>>> More AJAX & Prototype Articles          >>> More By Chrysanthus Forcha
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

AJAX & PROTOTYPE ARTICLES

- Best AJAX Tutorials for Forms
- The Best AJAX Tutorials
- 8 Great Ajax Tutorials
- Using Ajax and jQuery
- Using Ajax and jQuery with HTML Forms
- Ajax.org Offers Cloud9 IDE for JavaScript
- Java Technologies Provider ICEsoft Releases ...
- Using Recaptcha in AJAX Prototype Framework ...
- Google's Closure Compiler Service API: Addit...
- Installing Google Web Toolkit: Introducing t...
- Google's Closure Compiler Service API: Displ...
- Google's Closure Compiler Service API: Deliv...
- Google's Closure Compiler Service API: the A...
- Google's Closure Compiler Service API: the S...
- Google's Closure Compiler Service API: Optim...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: