**First of all, i'm sorry for my bad english!
I am trying to write a userscript for some website. This website updates himself every click or some seconds. (it uses ajax to update the view without refreshing) My userscript have to append some html elements when the user is in certain view. How can i run my code every view change? (after ajax)
The page have a function called ajaxCall
that sends an ajax request and changes the page according to the response.
I tried something like this:
var source = window.ajaxCall;
window.ajaxCall = function(param){
source(param);
myFunc();
}
this didn't work because ajaxCall
sends async ajax request, so: first, the source function called (ajax request started), and immediately after it, my function called. (before the ajax request succeed and view changed)
Is there a way to run my code immediately after page updates?
Thank you very much.