0

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:

errors:

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.

evolutionxbox
  • 3,932
  • 6
  • 34
  • 51
Husky7110
  • 23
  • 5
  • Im not sure if all of that is necessary... I tried a different api and it works fine in my file. could the problem be with this api? – Husky7110 Aug 21 '23 at 10:32
  • 1
    Yes, all of this **is** necessary if you want do make cross origin requests. That "other api" probably supports them already ... – derpirscher Aug 21 '23 at 11:41

0 Answers0