1
我嘗試整合jQuery自動完成插件[1],但沒有爲我工作。在這裏我的代碼:jQuery的問題自動完成
$('#input').autocomplete(function(term) {
var searchUrl = urlBase + 'tagging/autocomplete/?term=' + term;
$.getJSON(searchUrl, function(jsonData) {
test = jsonData;
console.log(test);
});
});
從的console.log輸出看起來像:
[ "EBE", "EBE1", "EBE2"]
對於輸出我使用的PHP函數json_encode()
echo json_encode ($words);
誰能告訴我,我的代碼有什麼問題?使用來自插件頁面的虛擬數據正在工作......但不是當我嘗試通過URI檢索數據時。
[1] http://docs.jquery.com/Plugins/Autocomplete
太棒了!適用於mit參數q ...;) – cupakob