Juan
Juan

Reputation: 15715

How can I emulate ajaxStart and ajaxStop without jQuery?

I've been looking at the jQuery code but is kinda huge. Would this be an easy task? Any idea how to do it?

The reason I want to do this is because I want to use it not for a web page but for a C# application that needs to know when there is ajax activity going on in a WebBrowser. So I would inject my javascript code in any web page I want to detect ajax activity, instead of injecting the whole jQuery which might be already present and cause a conflict.

Upvotes: 2

Views: 858

Answers (1)

Kevin Montrose
Kevin Montrose

Reputation: 22591

jQuery's ajaxStart doesn't fire for arbitrary XMLHttpRequest events, only for those coming from within jQuery.

You can trivially test* this by spinning up your own XMLHttpRequest after registering an ajaxStart handler.

So, technically, its easy to emulate: just route all your ajax traffic through a common method.

I doubt that's going to help you much since you won't actually capture all ajax requests, just the ones you kick off (and thus already know about, by definition).

*I did, since I wasn't sure.

Upvotes: 5

Related Questions