Tuesday, October 16, 2012

jquery ajaxSuccess vs ajaxComplete


Both the events ajaxSuccess & ajaxComplete get fired for every individual Ajax request, the difference is that the ajaxComplete event gets fired for every request which gets completed, irrespective of whether the request was successful of or ended with an exception, but the ajaxSuccess event gets fired only when the request gets executed successfully.

The syntax for both the events are almost similar, since they get fired for all the Ajax request we have to use the settings in the event parameters to indentify the request which raised this particular event.

The syntax for the ajaxComplete event handler is as follows.

ajaxComplete(function(objEvent, objXHR, objSettings))

objEvent        – The event Object
objXHR          - The XMLHttpRequest Object
objSettings    - Options used to make the Ajax Request


The syntax for the ajaxSuccess event handler is as follows.

ajaxSuccess(function(objEvent, objXHR, objSettings))


objEvent        – The event Object
objXHR          - The XMLHttpRequest Object
objSettings    - Options used to make the Ajax Request


Related Post

Search Flipkart Products:
Flipkart.com

No comments: