工作这是我的Jquery:jQuery UI的自动完成不asp.net
$("#completeMe").autocomplete({
source: function (request, response) {
$.ajax({
url: "/Main.aspx/GetAutocomplete",
type: "POST",
dataType: "json",
data: Data,
contentType: "application/json; charset=utf-8",
success: function (data) {
response($.map(data, function (item) {
return { value: item };
}))
}
})
}
});
这是我Main.aspx.cs:
[System.Web.Services.WebMethod]
public static List<string> GetAutocomplete(string cityName)
{
List<string> City = new List<string>() { "hh", "hh1" };
return City;
}
现在这个工程时,我不是返回列表的字符串。但是,当我使用它像这样用列表我得到:
Uncaught TypeError: undefined is not a function jquery-ui.min.js:9...
我不明白,这个方案似乎工作的许多人在网上,也许有事情做与我的jquery/UI版本?我正在使用jquery 1.7.1.min和jquery-ui最新版本。
可能值得一看你从WebMethod得到的回应;在浏览器中使用开发人员控制台,通常通过按F12键激活。 –