繁体   English   中英

jQuery TokenInput未加载结果

[英]Jquery TokenInput not loading results

我有:

$('.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

谢谢

您的代码不起作用,因为您编写了错误的语法。 如果您修复它,您的代码现在将正常运行。

onResult: function(result){
                console.log(result);
            } 

演示: http : //jsbin.com/yimiwumije/edit?html,js,output

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM