Here is the simplified of my code:
// script1.js
$(document).ready(function(){
.
.
function myfunc(){ ... }
.
.
});
// script2.js
$(document).ready(function(){
.
.
//doesn't work
$.getScript("./script1.js");
// anyway I need to call myfunc() here ... how can I access it?
.
.
});
As you can see, I've used $.getScript()
to require sccript1.js
file, but still myfunc()
is not defined there. How can I handle that?