I download Jquery UI autoload, looking to remote-jsonp.html. This is ajax function but i open console.. I can’t see any request in my console…
What is difference between dataType;”jsonp” and dataType;”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
}
}));
}
});
},
Reference http://jqueryui.com/demos/autocomplete/remote-jsonp.html
dataType: jsonpfor cross-domain request, that means request to different domain anddataType: jsonfor same domain-same origin request.Read about same origin policy
Read more about jQuery AJAX