3mpetri
3mpetri

Reputation: 599

Passing url to getJSON

getJSON works ok if I use json file locally, but I don't understand why can't I obtain it from external source?

For example:

$.getJSON('http://ninsuna.elis.ugent.be/rdf/data/tennis/Roland_Garros-25.05.2009-RogerFederer-RobinSoderling-set1-game1?output=json', 
function(data) {
  $('.result').html(data);
  alert('Loaded.');
});

The link outputs clean json file, but the method can't load it, in Firebug the response field is empty (unlike when I switch to local .json file).

Upvotes: 1

Views: 698

Answers (1)

Phil
Phil

Reputation: 164760

This violates the Same Origin Policy.

The exception to this rule is to use JSONP however the remote server needs to support the slightly different response format.

Upvotes: 3

Related Questions