2013-05-27 49 views
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); } has no method 'post'

但同樣的方法爲我以前的項目工作正常.. ..任何人都可以打電話給wat shud做?

+0

看起來你的頁面存在_ $ _衝突,請嘗試使用'jQuery'而不是'$'。 – undefined

+0

jQuery甚至包括正確? –

+0

[非常奇怪的jQuery錯誤]的可能重複(http://stackoverflow.com/questions/13708465/very-weird-jquery-error) – undefined

回答

1

似乎你沒有包括jQuery或有衝突。確保將jQuery添加到項目中,並且沒有其他庫使用命名空間或設置jQuery以noConflict模式運行。