Having real trouble trying to get this work. I am trying to pull data from the IGDB API using AJAX, as I plan to use the data to populate an auto complete search field. However I'm aware this is a cross-origin request and requires the data type to be 'jsonp'. The problem is, that when I get a response back I get an error that looks like the following:
From what I understand, this error is because the response from the 3rd party server isn't JSONP but JSON which is different from what is expected. This correct?
Is there a way I can retrieve the data from the above linked service and extract the data out to fill the auto complete field?
Current code:
$("#game-autocomplete").autocomplete({
source: function (request, response) {
var auth = "&token=MyAuthToken";
$.ajax({
url: "https://www.igdb.com/api/v1/games/search?q=" + request.term + auth,
dataType: "jsonp",
success: function (data) {
response($.map(data, function (value, key) {
return {
label: value,
value: key
};
}));
}
});
}
});