jQuery $ .getScript-旧功能&执行脚本中的变量 [英] jQuery $.getScript - old functions & variables in executed script
本文介绍了jQuery $ .getScript-旧功能&执行脚本中的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用jQuery $ .getScript执行JavaScript. 在执行的脚本中,我无法访问源文件的功能和变量.
i execute a javascript with jQuery $.getScript. In the executed script i haven't access to the functions and variables of my source file.
有解决方案吗?
推荐答案
由$ .getScript()执行的脚本确实可以访问全局上下文.您可以在外部脚本中使用任何全局变量(或与此相关的函数).
The script executed by $.getScript() does have access to the global context. You can use any global variable (or function for that matter) from within your external script.
这篇关于jQuery $ .getScript-旧功能&执行脚本中的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文