I'm using jQuery 1.10.2 and I'm getting the following error regarding the use of getScript. I load jquery, then call a JS file that contains this code. I even use an alert with the version of jQuery right before getScript is called so that I know it is loaded.
Uncaught TypeError: Cannot call method 'getScript' of undefined
Here is the code
$.noConflict();
jQuery(document).ready(function ($) {
load_scripts();
});
function pause_for_jquery(){
setTimeout(load_scripts, 50);
}
function load_scripts(){
if (!window.jQuery) {
pause_for_jquery();
}
else{
alert(jQuery.fn.jquery); //this alert works and displays '1.10.2'
$.getScript("url here", function() {});
}
}
$is undefined if you have used$.noConflict()?$.noConflict()really does, or why it's used.