I have a messaging system for which I do infinite scroll using jQuery.load. The problem is that the way I set it up, when the response of jQuery.load returns, all JS from the page is ran once again. This is fine, but I want to disable a particular JS block only if the request is an AJAX (jQuery.load).
Is it possible to do something like this?
if(!request_is_ajax){
run_some_code();
}
else{
// do nothing
}
Basically the code should run on the main pageload, but not on subsequent calls. I can detect this server-side, but that would be the last resort for me.