Reputation: 23
Basically i'm a noob and just need a starting point. Can you see what's wrong with my code?
$.getJSON('http://data.police.uk/api/crime-categories', function(json) {
alert(json.url.name);
});
as you can see I just want to get categories and print them out to the page.
link to jsFiddle http://jsfiddle.net/ZfvKm/2852/
Upvotes: 0
Views: 245
Reputation: 13564
The browser is preventing your AJAX call from retrieving this data due to the same origin policy. Basically, this means that your JavaScript code can only retrieve URLs which are at the same host (www.example.com), protocol (http or https), and port (80, 8080, etc..) as the page that is hosting the script.
Since it appears that this API does not support JSONP, you'll have to retrieve this through your server side code.
Upvotes: 2