Showing posts with label ajaxSuccess. Show all posts
Showing posts with label ajaxSuccess. Show all posts

Tuesday, October 16, 2012

jquery ajaxStop vs ajaxSuccess

The events ajaxStop fires only when all the Ajax requests in the page complete their execution, while the ajaxSuccess get fired for every individual Ajax request which executes succesfully.

The ajaxStop event handler does not provide any parameters since it gets fired only after all the Ajax requests in the page get completed, whereas the ajaxSuccess event handler provides the request object and a set of settings as parameters which can be used to identify the request for which the ajaxSuccess event got fired.

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

The syntax for the ajaxStop event handler is as follows.

ajaxStop(function())


Related Post


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.

jquery ajaxSuccess

The jQuery ajaxSuccess event gets fired when an Ajax requests gets completed successfully, it fires for every individual request which gets completed successfully in the page.
 
This event can be used to handle individual Ajax requests in a page, the handler of the ajaxSuccess gets fired when any of the request in the page get completed successfully, we should use the parameters of the event to identify which particular request got completed.

The ajaxSuccess event gets fired only when the request is executed successfully, will not get fired if the request ended in an error.

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