2014-02-27 135 views
1

我编写了任何文本,并向我显示与文本不匹配的结果。 无论我在现场插入什么,select2都会始终显示所有结果。Select2显示所有结果

$("#UserCliente").select2({ 
    minimumInputLength: 3, 
    ajax: { // instead of writing the function to execute the request we use Select2's convenient helper 
    url: "../clients/listaclients/", 
    dataType: 'json', 
    data: function (term) { 
     return { 
      term: term, // search term 
     }; 
    }, 
    results: function (data) { // parse the results into the format expected by Select2. 
     // since we are using custom formatting functions we do not need to alter remote JSON data 
     return {results: data}; 
    } 
}, 


}); 

enter image description here

这是怎么回事?

回答

1

我找到了解决方案。 很简单:我的json总是返回所有结果。我在php中进行了更改以搜索term并带来结果。 感谢