I'm having a problem doing something very basic in jQuery. Can someone tell me what I'm doing wrong exactly?

如果我运行下面的代码,函数$.get似乎不见了(getJSON和其他一些也不见了).但是$本身和其他函数确实存在,所以我知道JQuery正在加载.

google.load("jquery", "1.3.2");

function _validate(form, rules_file) {
   $.get('/validation_rules.json',function(data) {
     alert("hello")
   })
} 

任何 idea 都将不胜感激.

谢谢, 抢劫

Edit: here is some additional info:

  <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>

推荐答案

您拥有的$个变量来自Prototype js,因为您使用的是jQuery.noConflict方法.

该方法将把$变量恢复到最先实现它的库中.

您应该直接在jQuery个全局对象上使用jQuery方法,例如:

jQuery.get(/* .. */);
jQuery.getJSON(/* .. */);
// etc...

或者,如果需要,可以将另一个较短的变量定义为alias:

var $j = jQuery.noConflict();

Jquery相关问答推荐

当我使用 OwlCarousel 时,没有任何显示

jquery克隆div并将其附加在特定div之后

如何在 jquery 中包含 !important

TypeScript 中是否有this的别名?

在 select2 中使用 AJAX 进行标记

jQuery 中的 $this 与 $(this)

以ajax方式在rails 3中提交表单(使用jQuery)

如何使用 jQuery Select 单个子元素?

模态窗口中的 Twitter Bootstrap Datepicker

使用jquery设置di​​v标签的值

如何使用 jQuery 从 div 中删除 id 属性?

使用 jquery 在 radio 上单击或更改事件

将打开/关闭图标添加到 Twitter Bootstrap 可折叠项(手风琴)

停止输入/书写后如何触发输入文本中的事件?

jquery在加载时获取iframe内容的高度

jQuery 按值 Select 选项元素

图片转Base64

$.ajax 的成功和 .done() 方法有什么区别

如何使用 jquery 使下拉列表只读?

jQuery中的wait()或sleep()函数?