Skip to content Skip to sidebar Skip to footer

Using Of Fetch API The Unexpected End Of Input Error Occurr

fetch('http://www.freegamesforyourwebsite.com/feeds/games/? tag=platform&limit=100&format=json', { method:'GET', mode:'no-cors', dataType: 'json', headers: { 'A

Solution 1:

You said mode:'no-cors', so fetch doesn't attempt to read data across origins (which is forbidden by default), and it doesn't throw an error (because you told it you didn't want to try to read data across origins).

Change it to mode: "cors".

Ensure the server you are requesting the data from grants you permission to read the response using the Access-Control-Allow-Origin header.


See also this answer about the Same Origin Policy.


Post a Comment for "Using Of Fetch API The Unexpected End Of Input Error Occurr"