I want to call a function that's in another JavaScript file.
function foo(){
//before $.getScript
$.getScript('otherScript.js', function() {
otherFoo();
});
//after $.getScript
}
But this will execute the whole $(document).ready() part of otherScript.js before calling otherFoo() function. How can I prevent $(document).ready() from being called and call only otherFoo() function?
You can't do this.
It will run the whole file. If you don't want anything to run then put everything in otherScript.js in functions.
What you wish to do is not possible without writing a seperate parser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With