I'm trying to use the iTunes search API with angularjs. This is me making my request
var itunesURL = 'https://itunes.apple.com/search?'
var encoded = encodeURIComponent($scope.search);
var apiURL = itunesURL + 'term=' + encoded + '&country=US&media=music&limit=5';
$http({
method: 'GET',
url: apiURL
}).then(function successCallback(response) {
console.log(response.data);
}, function errorCallback(response) {
console.log('the request failed');
});
the search variable on the scope represents what the user typed in the search bar. But I'm getting this error...
XMLHttpRequest cannot load https://itunes.apple.com/search?term=What%20I%27ve%20Done&country=US&media=music&limit=5. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.