简体   繁体   中英

Jquery TokenInput not loading results

I have:

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

[  
   {  
      "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"
   }
]

The code shows loading texts, but the JSON output is not renderized in text field and onResult is not fired

Thanks

your code not work because you write wrong syntax. if you fix it, your code will run normally now.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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