Reputation: 69
Before writing my code I would like to say that I have to be using Notepad ++ and a normal web like chrome to get this to work. So through writing code in mocky io with the advanced mode (so adding Access-Control-Allow-Origin
and *
), then getting the link and placing it in my code I should get response in the console log.
Here is the code for you to see:
<html>
<html lang="en">
<head>
<title>JavaScript-Fetch</title>
</head>
<body>
<script>
fetch('http://www.mocky.io/v2/5aa39fa3310000461026e28c').
then(function(response){
console.log('response')
})
</script>
</body>
</html>
Upvotes: 0
Views: 3215
Reputation: 173
I resolved my problem with mocky io using
https://cors.io/?http://www.mocky.io/v2/yourlink
Upvotes: 3