我在用 jQuery 做一些非常基本的事情时遇到了问题。谁能告诉我我究竟做错了什么?
如果我运行下面的代码,函数 $.get 似乎丢失了(getJSON 和其他函数也丢失了)。但是 $ 本身和其他函数确实存在,所以我知道 JQuery 正在加载。
google.load("jquery", "1.3.2");
function _validate(form, rules_file) {
$.get('/validation_rules.json',function(data) {
alert("hello")
})
}
任何想法将不胜感激。
谢谢, 罗布
编辑:这里是一些附加信息:
<script src="http://www.google.com/jsapi"></script>
<script>
google.load("prototype", "1.6");
google.load("scriptaculous", "1.8");
google.load("jquery", "1.3.2");
</script>
<script>
jQuery.noConflict(); // prevent conflicts with prototype
</script>
<script src="/livepipe/src/livepipe.js"
type="text/javascript"></script>
<script src="/livepipe/src/window.js"
type="text/javascript"></script>
<script src="/livepipe/src/tabs.js"
type="text/javascript"></script>
<script src="/jquery.maskedinput-1.2.2.js"
type="text/javascript"></script>
最佳答案
如果您使用 jQuery 的 SLIM 版本,也会发生这种情况。
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
给我
>jQuery.get
:undefined
>jQuery.get()
:VM7130:1 Uncaught TypeError: jQuery.get is not a function
at <anonymous>:1:8
在没有 slim 选项的情况下加载相同的库
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
效果不错
jQuery.get() :Object {readyState: 1}
关于javascript - JQuery: $.get 不是一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1956719/