$("#CustomerName").autocomplete({
//source: "/Test/Project/GetCompanySelectJson",
source: [{ "label": "江蘇燈為有限公司", "value": 2 }, { "label": "城中投資發展有限公司", "value": 4 }, { "label": "國啦為要", "value": 5 }],
select: function (event, ui) {
$("#CustomerName").val(ui.item.label);
$("#CustomerId").val(ui.item.value);
event.preventDefault();
}
});使用上面的Source,autocomplete會索引出全部記錄,而不是按輸入的關鍵字,通過F12查看獲得的數據,就是下面的Source值,換成下面的Source是正常使用,也就是說代碼應該是沒有問題的,為什么上面的Source就索引全部呢?
Jquery autocomplete使用URL方式出錯
弒天下
2018-08-08 10:09:41