我正在尝试使用 jqueryUi 进行自动完成,但无法将数据绑定到它。
$("#CustomerName").autocomplete({
source:
function () {
$.ajax({
url: "SearchCustomer?key=" + $("#CustomerName").val(),
async: false,
dataType:"json",
success: function (data) {
return data.ResultList;
}
})
},
minLength: 0, autoFocus: true, delay: 1000
});
我的ajax结果是 -
{"Message":null,"Successfull":false,"Id":0,"Result":null,"ResultList":["Customer 2","Kohl\u0027s Corp","Test Corp"]}
如果我使用它,那么它工作正常
$("#CustomerName").autocomplete({
source:["Customer 2","Kohl\u0027s Corp","Test Corp"],
minLength: 0, autoFocus: true, delay: 1000
});
提前致谢 !