Answers for "js fetch cors error"

1

fetch api cors

fetch(URL, {
  mode: 'cors',
  headers: {
    'Access-Control-Allow-Origin':'*'
  }
})
  .then(response => response.json())
  .then(data => {
Posted by: Guest on October-20-2021
-1

fetch request allow cors

// From http://foo.com/
fetch('http://bar.com/data.json', { 
    mode: 'no-cors' // 'cors' by default
}).then(function(response) {
    // Do something with response
});
Posted by: Guest on June-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language