【问题标题】:$.post() not working in Jquery$.post() 在 Jquery 中不起作用
【发布时间】:2013-05-27 08:01:38
【问题描述】:

这是我的代码

var citylist = []; 
var index = 0; 
var url = "http://test.com/index.php"; 
var posting = $.post( url, { keystring: ""});
posting.done(function( data ) { 
  $.each(data, function(key, value) { 
     console.log(data);
     $.each(data, function(key, value) {
       citylist[index] = value;
       index++;
});
    if (index > 0) {
      $( "#destination_to" ).autocomplete({source: citylist});
    }
});

但我收到以下错误

未捕获的类型错误: 对象函数 (e,l){return document.id(e,l,this.document); } 没有方法'post'

但是对于我之前的项目,同样的方法可以正常工作....任何人都可以打电话吗??

【问题讨论】:

  • 您的页面中似乎存在 $ 冲突,请尝试使用jQuery 而不是$
  • jQuery 是否正确包含在内?
  • Very weird jQuery error 的可能重复项

标签: jquery .post


【解决方案1】:

似乎您没有包含 jQuery 或存在冲突。确保在项目中包含 jQuery,并且没有其他库使用 $ 命名空间或将 jQuery 设置为在 noConflict 模式下运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-07
    • 1970-01-01
    • 1970-01-01
    • 2012-12-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多