Javascript JQuery UI自动完成源函数ajax webservice调用不工作
我需要一些关于Jquery源函数的帮助,该函数使用Ajax webservice调用。我正在自动完成中获取数据,但是Javascript JQuery UI自动完成源函数ajax webservice调用不工作,javascript,jquery,ajax,web-services,jquery-ui,Javascript,Jquery,Ajax,Web Services,Jquery Ui,我需要一些关于Jquery源函数的帮助,该函数使用Ajax webservice调用。我正在自动完成中获取数据,但是 作为用户类型,它目前不提供任何建议 如何突出显示文本 我的HTML 滑动分页 \来源:函数(请求、响应){ $.ajax({ url:“”, 数据:“{'前缀':'”+request.term+“}”, 数据类型:“json”, 类型:“POST”, contentType:“应用程序/json;字符集=utf-8”, 成功:功能(数据){ 响应($.map)(数据.d,函数
滑动分页
\来源:函数(请求、响应){
$.ajax({
url:“”,
数据:“{'前缀':'”+request.term+“}”,
数据类型:“json”,
类型:“POST”,
contentType:“应用程序/json;字符集=utf-8”,
成功:功能(数据){
响应($.map)(数据.d,函数(项){
返回{
标签:item.split('-')[0],
val:item.split('-')[1]
}
}))
},
});
var matcher=newregexp($.ui.autocomplete.escapeRegex(request.term),“i”);
响应(this.element.children().map)(函数(数据){
var text=data.d;
if(this.value&(!request.term | | matcher.test(text)))
返回{
标签:文本,
值:文本
};
}));
},
。建议用户
不在提供的代码中。这是一个类、html元素、方法还是什么?很抱歉造成混淆,当用户开始键入时,我的代码没有提供任何建议。这是.autocomplete
小部件的一部分吗?你能包含更多的上下文吗?是的,我使用的是Jquery UI自动完成,请看这里的源代码。不幸的是,我不知所措\
<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
};
}));
},