来自我试图调用file1.js中定义的function foo((的file2.js。在file1.js中,该功能看起来像:
function foo(){
alert("Here");
}
在file2.js中,我尝试以这样的方式调用此功能:
$.getscript('file1.js', function(){
foo();
});
但是,此功能并未调用。我需要做什么来解决这个问题?感谢您的任何回复。
您在getScript
中有错字(请注意情况(:
$.getScript('file1.js', function() {...});
每个jQuery getcript文档:https://api.jquery.com/jquery.getscript/