Friday, October 12, 2012

jQuery Ajax Error Handling

Handling errors is an important activity while using Ajax, since it will be difficult Ajax requests, the requests will be shared between the Client and the Server side, to successfully debug an error we will have to keep track of both the Client side and the Server side code, hence it becomes more important to track more efficiently while using Ajax.

jQuery provides an error handler event ajaxError to handle errors which occur while making Ajax requests using jQuery. We can bind the ajaxError event to an error handler method and use the method to display the errors in an user friendly way.

The syntax for ajaxError event is as follows.

.ajaxError(function(event, jqXHR, ajaxSettings, jsExe))

When an error occurs while handling the Ajax request the function fnErrorHandler will be called.
Event            – The event Object
jqXHR            - The XMLHttpRequest Object
ajaxSettings   - Options used to make the Ajax Request
jsExe            - JavaScript exception.

Related Post

Search Flipkart Products:

No comments: