Reputation: 2432
I'm trying to crate a code that will get some info about a movie using some IMDB API, but I'm getting two errors that I can't fix...
This is the code:
<body>
<h1>The bourne Legacy</h1>
<h2>2012</h2>
<script>
(function() {
function getMovieInfo( title, year ) {
$.ajax({
type : 'GET',
url: "http://www.deanclatworthy.com/imdb/",
dataType: 'jsonp',
data: { 'q': title, 'year': year },
success: function(info) {
console.log(info.year);
}
});
}
getMovieInfo( $('h1').text(), $('h2').text() );
})();
</script>
</body>
and the errors are the next:
Resource interpreted as Script but transferred with MIME type text/html: "http://www.deanclatworthy.com/imdb/?callback=jQuery18108839007553178817_1347625688866&q=The+bourne+Legacy&year=2012&_=1347625688869". jquery.min.js:2
Uncaught SyntaxError: Unexpected token : www.deanclatworthy.com:1
Upvotes: 0
Views: 164
Reputation: 123
function getMovieInfo( title, year ) {
$.ajax({
type : 'GET',
url: "http://www.deanclatworthy.com/imdb/",
dataType: 'json',
data: { 'q': title, 'year': year },
success: function(info) {
console.log(info.year);
}
});
}
getMovieInfo( $('h1').text(), $('h2').text() );
});
Upvotes: 0