javascript - JQuery: $.get 不是一个函数

标签 javascript jquery

我在用 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/

相关文章:

javascript - 网站上的标签 html 遇到问题

javascript - 如何在文本框中设置值 - asp.net 使用 jquery?

javascript - 重新启动 JavaScript 中的方法

javascript - EmberJS : promise callbacks when view is destroyed?

javascript - 如何防止页面在表单提交后重新加载 - JQuery

javascript - 获取表单值仅在 IE 中返回未定义

jquery - 使用 jquery/greasemonkey 从样式表克隆 css 样式

javascript - 单击按钮后如何更改颜色按钮

javascript - 在 Bootstrap 模式中打开 href

javascript - 在 Chrome 开发者工具中,如何禁用刷新元素周围的突出显示?