对不起,我找不到回复..
我的问题是我无法检索所选产品的id。值=0
我的代码:
$("#recherche").typeahead({
onSelect: function(item) {
alert(item.value); // = 0
},
ajax: {
url: "/personne/autocompletation",
displayField: "nomComplet",
triggerLength: 1,
method: "POST",
dataType: "JSON",
preDispatch: function (query) {
return {
query: query
}
}
},
});我的代码HTML
<li class="active" data-value="0"><a href="#"><strong>C</strong>alloway</a></li>对不起,我的英语...
发布于 2016-12-05 00:39:55
尝尝这个
$("#recherche").typeahead({
source: function(query, process){
$.ajax({
url: "/personne/autocompletation",
displayField: "nomComplet",
triggerLength: 1,
method: "POST",
dataType: "JSON",
success: function (data) {
console.log(data);
}
});
}});
https://stackoverflow.com/questions/40942148
复制相似问题