Need some help understanding the difference between the success and ajaxSuccess events documented here.
success is a local event, while ajaxSuccess is a global event. I understand the difference between a local and global variable, but am having some trouble understanding the concept of event scope.
What are some sample scenarios where one would be preferred over the other?
you can use global events as such:
as the global event will fire for every ajax call success, not just the one.
but the
ONLY fires within the local ajax call function as a private object of that.
Note the
might be what you are after as it fires on the complete – with or without an error.
EDIT: Special note of the local
success:in ajaxSetup global: (this is NOT recommended and you should use the$.ajaxSuccess)Now, why would we use one over the other? Perhaps you need special filtering of the object returned: