Basically what I want to do is to be able to detect when the particular page loads in some data dynamically.
This needs to be general as the script will run across a lot of websites whose js content or other content/configuration I am unaware of. My intention is that everytime something new is loaded onto the page it is picked up within my code so I can execute some other code as a result.
For instance, in an ideal world the following code/similar would exist;
alert('my code here gets executed!');
I have not been able to find something like it and need it badly. One particular solution was to simply execute the code every 10 seconds or so (in hope new data may have been loaded in) but this is highly inefficient as it hogs the resources of the browser for about one second or so when my code analyses the page each time. It would be ideal if the analysis was only done at an appropriate point (when new data is loaded in).
I don't know any way of automatically picking up on any AJAX request that happens on a page by dropping in a function. If I thought long and hard I might think of a way. But, why not just add a call to your function in the AJAX request on "complete"?