0

I am looking for a listener to receive ajax events before any Ajax method is invoked. I see there is an ajaxLIstsner in JQuery which would work if all my ajax requests were coming from JQuery. But there are not. So, question is how would I implement such a listener in core JavaScript.

Thanks.

More Than Five
  • 9,959
  • 21
  • 77
  • 127
  • 1
    What type of events do you want to listen out for? – ForOhFor Jun 10 '13 at 15:51
  • That's impossible without messing with the builtin objects. Why would you need that? Just use some kind of notification system like jQuery does. – Bergi Jun 10 '13 at 15:58
  • 1
    maybe this can be helpful -> http://stackoverflow.com/questions/3596583/javascript-detect-an-ajax-event – ElSinus Jun 10 '13 at 16:00
  • 1
    If you're just doing this for debugging, it would be far easier to just open your network tab in the console. I can't think of any other reason you'd want to do this. – Kevin B Jun 10 '13 at 16:03

1 Answers1

0

You can override the xhr prototype, see http://oreilly.com/pub/h/4133

mguimard
  • 1,881
  • 13
  • 14