我下载了Jquery UI autoload,寻找remote-jsonp.html。这是AJAX的功能,但我打开控制台..我看不到我的控制台任何请求......dataType jsonp和JSON之间的区别
是什么的dataType之间的差异;的dataType“JSONP”和;“JSON”
$("#city").autocomplete({
source: function(request, response) {
$.ajax({
url: "http://ws.geonames.org/searchJSON",
dataType: "jsonp",
data: {
featureClass: "P",
style: "full",
maxRows: 12,
name_startsWith: request.term
},
success: function(data) {
response($.map(data.geonames, function(item) {
return {
label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
value: item.name
}
}));
}
});
},
参考http://jqueryui.com/demos/autocomplete/remote-jsonp.html
'跨浏览器'或'跨域'? :s –
@Joy绝对跨域。 –
@Joy感谢 – thecodeparadox