我在MVC项目中使用Bootstrap Ajax Typeahead。如果服务器返回零结果,我有什么办法可以显示“没有匹配结果”。
$(".control").typeahead({
onSelect: function (item) {
$("#testId").val(item.value);
console.log(item);
},
ajax: {
url: "/Controller/ActionName",
timeout: 500,
displayField: "Name",
valueField: "Value",
triggerLength: 2,
method: "get",
loadingClass: "loading-circle",
preDispatch: function (query) {
//showLoadingMask(true);
return {
queryName: query
}
}
}
});