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