I have searched through this question here: No 'Access-Control-Allow-Origin' header is present on the requested resource—when trying to get data from a REST API
I looked at every answer on there and none of them seem to work for me.
Here is my code:
fetch('https://transfermarkt-api.vercel.app/players/122153/transfers', {
method: 'GET',
headers: {
'accept': 'application/json'
},
})
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error('Error:', error);
});
These are the errors I keep getting:
I'm pretty sure that the api is causing all these errors, but I don't get why none of the dozens of solutions I have looked at are working.