Basically I have a script.js in my website that does this:
if (someVar){
document.write('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"><\/script>');
}
Now I would like to attack some behaviour:
if (someVar){
document.write('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"><\/script>');
$(document).ready(function(){
//> Do stuff
});
}
But I got undeclared function $ in console
document.writewrites given string after the script it was called in. If you want to bind to$(document).ready()you can move this part of code to a separate file, that is included after the file withdocument.writefunction.