I have a div with an image that I'm getting from an API
let newIcon = (query) => {
return $.ajax({
url: "https://noun-project-proxy.herokuapp.com/v1",
method: 'GET',
data: {
url: `icons/${query}`,
params: JSON.stringify({
})
}
}).then(function (response) {
let image = response.icons[0].preview_url;
$("#container1").append(`<div><img
src="${image}"></div>`);
});
The image will show up on localhost but when I deploy the site I get the error "No 'Access-Control-Allow-Origin' header is present on the requested resource"
I can't figure out how to get past this error. Can anyone help me out? I've tried adding crossOrigin='anonymous' to the img but that blocks the picture on both the deployed version and localhost