You need &callback=?in the url to run JSONP, for example:
$.getJSON('https://ajax.googleapis.com/ajax/services/search/images?q=Google&v=1.0&callback=?',
function(json) {
alert(json);
});
You can check it out here . Without &callback?it, it tries to retrieve data from the remote domain using XmlHttpRequest (AJAX) and will not / be blocked due to the same origin policy . This is just the type of JSONP situation for.
$.getJSON() docs:
JSONP
URL- "callback =?" ( , API- ), JSONP. . jsonp $.ajax().