I am attempting to match an id of a table cell with an id specified within a JSON file. If a match is found I will later do something with the description. Everytime this is ran, it skips straight to the error message. What am I doing wrong?
function getJSON(showID){
$.ajax({
type: 'GET',
url:'json/tvshows.json',
dataType: 'jsonp',
success: function(data){
$.each(data, function(key,tvshow){
tvshow.description;
var tvshowId = tvshow.id;
if (tvshowId == showID) {
var description = tvshow.description;
console.log(description);
}
})
},
error:function(){
console.log('Error occured in getDescription');
}
}); //Ends ajax request
}