I am trying to apply a .js file to a page I loaded via ajax (since ajax automatically strips the content of all the javascript).
var url;
var textUrl = 'local/file.js';
$('a').click(function() {
url = $(this).attr('href');
$('.secondaryDiv').load(url, function() {
$.getScript(textUrl, function(data, textStatus, jqxhr) {
console.log(data); //data returned from getScript
console.log(textStatus); //return "success"
console.log(jqxhr.status); //200
});
});
return false;
});
Am I approaching this the right way? I tried everything I could think of and I can't get it to work