I am trying to make a cross-domain AJAX call with the latest jQuery for the Twitch.TV API and I'm getting an error.
Code:
$.ajax({
type: 'GET',
dataType: "json",
url: "https://api.twitch.tv/kraken/search/games?q=star&type=suggest",
success: function (responseData, textStatus, jqXHR) {
console.log("in");
var data = JSON.parse(responseData['AuthenticateUserResult']);
console.log(data);
},
error: function (responseData, textStatus, errorThrown) {
alert('POST failed.');
}
});
Error:
XMLHttpRequest cannot load https://api.twitch.tv/kraken/search/games?q=star&type=suggest. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://codeeplus.net' is therefore not allowed access.