The URL below responds with a .txt
file in web browser. How would I console.log()
the data inside .txt
file using Fetch API in JavaScript?
Here abovementioned URL:
http://google.com/complete/search?client=chrome&q=python
The promise is fulfilled but i didn't find a way to get the data inside .txt
file
fetch("http://google.com/complete/search?client=chrome&q=python", {
method: 'GET',
mode: 'no-cors',
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582',
'Content-Type': 'text/plain',
},
})