I have a problem with Fetch Javascript
let url = "https://www.teste.com.br/ws"
fetch(url,{
mode: 'no-cors',
method: 'GET',
headers: {'Accept': 'application/json','Content-Type': 'application/json'}
}).then(function(response){
response.json().then(function(data) {
console.log(data);
})
}).catch(function(error){
console.log(error);
});
The error message appears (Uncaught (in promise) SyntaxError: Unexpected end of input at fetch.js: 10 which is the line "response.json (). then (function (data) {" Can someone help me solve this?
Thank you.