我下載了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