Question

I have a problem where I need to be able to detect AJAX calls on a general ASP.NET page. However this page is automatically generated so I cannot add any code or script managers to it, that aren't already generated.

I basically need a way of detecting generic AJAX calls with JQuery or general JavaScript. I am unable to add code that makes the ajax calls either. So it needs to be as generic as possible and be able to detect an AJAX call.

I have already tried the ajaxComplete JQuery function, but this did not work as the ajax calls don't have starts or stops assigned to them.

The reason I have this problem is because I have a server control written in C# ASP.NET and its a plugin to a page, and needs to detect AJAX queries on the page. However I cannot modify the contents of the page, only the control.

Is this possible? Any ideas?

EDIT:

In the end we fixed the problem another way. We didnt need to detect the AJAX calls after all. Instead we had JavaScript that loads when our control does and we wrapped the JQuery document ready function with the page load function like so:

function pageLoad() {
    $(document).ready(function () {
        stuff();
    });
}
Was it helpful?

Solution

Not sure it's works for you but only solution is,

jQuery(document.body).ajaxStart(function(){
    // start ajax call
}).ajaxStop(function(){
    // end ajax call
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top