Rows[]
而是Object.Rows[]
我似乎无法在下面获得语法。我原本以为项目会切换到item.Rows,但这似乎没有用。帮助
$('#reportingLocationLookup').autocomplete({
minLength: 3,
delay: 1000, //milliseconds,
source: function (request, response) {
var dto = { 'term': request.term, 'take': 10 };
//Ajax
var urlMethod = window.siteRoot + "Invoices/ListPostalLocations";
var jsonData = JSON.stringify(dto);
window.SendAjax(urlMethod, jsonData, response);
},
focus: function () {
return false;
},
select: function (event, ui) {
return false;
}
}).data("autocomplete")._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a>" + item.PostalCode + " - " + item.CityAlias + ", " + item.StateAbbreviation + "</a>").appendTo(ul);
};
答案 0 :(得分:4)
自动填充小部件需要将Array
提供给response
功能。这意味着您将不得不调整success
来电的SendAjax
参数:
/* snip */
source: function (request, response) {
var dto = { 'term': request.term, 'take': 10 };
//Ajax
var urlMethod = window.siteRoot + "Invoices/ListPostalLocations";
var jsonData = JSON.stringify(dto);
window.SendAjax(urlMethod, jsonData, function(data) {
response(data.Rows);
});
},
/* snip */
基本上,在响应对象中发送response
(自动完成提供的回调函数)数组。