0
async function fetching() {
// const apiUrl = "https://www.fishwatch.gov/api/species"
const response = await fetch("https://www.fishwatch.gov/api/species")
const data = await response.json()
console.log(data)
}
fetching()

i am trying to get the json from the above API url, however, i am getting the This is the image of error. Access to fetch at 'https://www.fishwatch.gov/api/species' from origin 'http://127.0.0.1:5500' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Nommiiee
  • 25
  • 3
  • 2
    Does this answer your question? [Why does my JavaScript code receive a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error, while Postman does not?](https://stackoverflow.com/questions/20035101/why-does-my-javascript-code-receive-a-no-access-control-allow-origin-header-i) – evolutionxbox Feb 22 '22 at 16:37

0 Answers0