我已经浏览过这些问题,但我找不到任何能帮助我完成工作的内容。
它进入ajax。 有人告诉我禁用这两个字符串:
//contentType: "application/json; charset=utf-8",
//dataType: "json",
但它无论如何都不起作用。
我得到这个:无法读取未定义的属性长度,如果我使用数据类型,则会出现另一个错误。 似乎jquery-1.10.2.js文件中存在错误
$("#MainContent_TxtCitta").autocomplete({
source: function (request, response)
{
$.ajax({
url: "/CodiceFiscale/CaricaTextBox",
//contentType: "application/json; charset=utf-8",
//dataType: "json",
type: 'POST',
async: false,
dataFilter: function (data) { return data; },
data: "{ 'Citta': '" + request.term + "' }",
success: function (data) {
response($.map(data.d, function (item) {
return {
value: item.Citta
}
}))
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus, errorThrown);
alert(XMLHttpRequest.responseJSON);
alert(XMLHttpRequest.responseText);
}
});
},
minLength: 2,
(我已尝试使用jquery-1.11.1.js,同样的问题)