我有:
$('.titulares').tokenInput("http://localhost/ajax/ajax.php",{
tokenLimit: 1,
queryParam: 'query',
propertyToSearch: 'nome',
resultsLimit: 2,
tokenValue: 'id',
noResultsText: 'Nada',
searchingText: "Procurando...",
hintText: "Buscar titular",
method: 'GET',
onResult(){
alert('a');
}
});
ajax.php JSON输出:
[
{
"id":12,
"nome":"Joe Bill"
},
{
"id":13,
"nome":"PJ"
},
{
"id":14,
"nome":"John"
},
{
"id":16,
"nome":"Acme"
},
{
"id":17,
"nome":"Acme2"
},
{
"id":18,
"nome":"Acme3"
}
]
代码显示加载文本,但JSON输出未在文本字段中重新定义,并且onResult未被触发
谢谢
答案 0 :(得分:0)
您的代码无效,因为您编写了错误的语法。如果你修复它,你的代码现在就会正常运行。
onResult: function(result){
console.log(result);
}