Difference between dataType jsonp and JSON

ajax, javascript, jquery, jquery-ui

Solution

`dataType: jsonp` for cross-domain request, that means request to different domain and `dataType: json` for same domain-same origin request.

Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to the URL unless the cache option is set to true.

Read about same origin policy

Read more about jQuery AJAX

Problem

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

Original source