Which is to be used at which time.
In the documentation on http://api.jquery.com/:
For ajaxStop() it says:
Description: Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.
And for the ajaxComplete() it says:
Description: Register a handler to be called when Ajax requests complete. This is an Ajax Event.
From what I can see ajaxComplete() is more flexible due to:
All ajaxComplete handlers are invoked, regardless of what Ajax request was completed. If we must differentiate between the requests, we can use the parameters passed to the handler. Each time an ajaxComplete handler is executed, it is passed the event object, the XMLHttpRequest object, and the settings object that was used in the creation of the request.
Can someone explain what each is for and the appropriate usage for each. In an application I built recently I relied on ajaxStop() to fire when my ajax calls were finished. I would then parse the returned data for result of server side operation. Now I am starting to wonder if I should have used ajaxComplete() instead or a combination of both for various situations.
Thoughts are appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…