1

这是我的代码

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});
    }
});

但我收到以下错误

Uncaught TypeError: Object function (e,l){return document.id(e,l,this.document); } 没有方法'post'

但同样的方法适用于我以前的项目....任何人都可以打电话给我吗?

4

1 回答 1

1

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

于 2013-05-27T08:10:40.137 回答