Trying to practice pulling data via an API with jQuery. I watched some YouTube tutorial and I'm basically just trying to get a successful response... but I can't for the life of me get it to work..
Apart from YouTube, I'm subscribed to Codeschool and they cover ajax and json, but they don't have a real life example unfortunately... or at least not yet.
The API I'm using is My API Films - http://www.myapifilms.com/imdb.do jsfiddle and code are below.
I guess it will be better if you get your own tokens? Many many thanks in advance.
https://jsfiddle.net/oddtbaq6/
var url = 'http://www.myapifilms.com/imdb/idIMDB?title=batman&' + token + '&format=json&language=en-us&aka=0&business=0&seasons=0&seasonYear=0&technical=0&filter=2&exactFilter=0&limit=1&forceYear=0&trailers=0&movieTrivia=0&awards=0&moviePhotos=0&movieVideos=0&actors=0&biography=0&uniqueName=0&filmography=0&bornAndDead=0&starSign=0&actorActress=0&actorTrivia=0&similarMovies=0&adultSearch=0&goofs=0"es=0&fullSize=0&companyCredits=0';
$.ajax(url, {
success: function(data) {
console.log(data);
},
error: function() {
console.log('error');
},
dataType: 'json',
type: 'GET'
});
console errors:
XMLHttpRequest cannot load.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'null' is therefore not allowed access.