簡體   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