jQueryオートコンプリートを変更して値の代わりにIDを使用するにはどうすればよいですか? 私は名前のリストを表示したいが、Id値を使って検索を送る。今では名前と適切に動作していますが、IDとして固有の値を見つけようとするとより効果的になると思います。Jqueryオートコンプリート表示名と送信ID
$.getJSON('Dashboard/CompaniesWithId', function (data) {
$.each(data, function (i, item) {
sellers[i] = item.Name;
sellersID[i] = item.Id;
});
}).error(function() {
console.log("error loading seller to the autocomplete");
});
$("#searchSeller").autocomplete({
messages: {
noResults: 'No sellers with this name',
},
minLength: 2,
delay: 500,
source: sellers,
});