我在Jquery源代码函数中需要一些帮助,该函数使用Ajax webservice调用。我在自动完成中获取数据,但是,
<body>
<div class="ui-widget">
<select id="combobox">
</select>
</div>
</body>
_source: function (request, response) {
$.ajax({
url: '<%=ResolveUrl("~/WebService/Automobile.asmx/GetCarList") %>',
data: "{ 'prefix': '" + request.term + "'}",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('-')[0],
val: item.split('-')[1]
}
}))
},
});
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
response(this.element.children().map(function (data) {
var text = data.d;
if (this.value && (!request.term || matcher.test(text)))
return {
label: text,
value: text
};
}));
},