Is it possible to have a global event handler for ajax requests that automatically gets called when any ajax request returns ?
I’m interested in this because I’m making a greasemonkey script for an ajax site. In previous scripts I either ran the main function every few seconds or overwrote parts of the site’s javascript, both things that are messy.
Not with regular XMLHttpRequest. Some libraries like jQuery provide wrappers (e.g. ajaxComplete) for this. They will only fire for ajax requests that also use the wrapper (e.g. jQuery.ajax).