我使用以下代码进行自动填充:
jQuery('#id')
.autocomplete({
"select":function (event, ui)
{
return false;
},
"focus":function(event, ui)
{
return false;
},
"minLength":"3",
"source":function( request, response )
{
jQuery.ajax({
type: 'GET',
url: 'http://localhost/autocompleteex',
dataType: 'jsonp',
jsonp: "jsonp-callback",
contentType: 'application/json; charset=utf-8',
data: {
search:request.term,
},
success: function(data) {
response($.map( data, function( item ) {
return {
label: item.label,
value: item.value
}
}));
},
error: function (msg) {
console.log(' Status : '+ JSON.stringify(msg));
}
});
}
});
服务器将JSON字符串返回为:
"jQuery111305726958822940869_1443857160714([{\"value\":\"IKlaAbB77L36ovoVTIHWzWaAbB77m0kJ6XsjPMsl6i7oIz2TVPxt8s6eC7rEt
\",\"label\":\"A Fantis Parochial School, BROOKLYN NY\"}]);"
我错过了什么。它始终显示错误控制台日志。有什么想法吗?