i am trying to get data from this api: https://transfermarkt-api.vercel.app/players/122153/transfers
When running a fetch request i get some errors. (when i paste the url in my browser it displays data)
Here is the code i am trying to run:
fetch('https://transfermarkt-api.vercel.app/players/122153/transfers', {
method: 'GET',
headers: {
'accept': 'application/json'
}
})
.then(response => response.json())
.then(data => {
console.log(data); // Handle the response data here
})
.catch(error => {
console.error('Error:', error); // Handle errors here
});
Errors displayed in console:
I highly appreciate any help
I have looked at some questions that all seemed a little too complex for what i am trying to do, so i thought i would ask.