JSFiddle - React, Tailwind, and code Playground
by thelifeisyours
JavaScript
//fetch('https://cdn.discordapp.com/attachments/572973923201712130/655122293999009852/texto.txt', {headers: {'Content-Type': 'text/plain'}).then(res => console.log(res));
getData('https://cdn.discordapp.com/attachments/572973923201712130/655122293999009852/texto');
function getData(pageId) {
console.log(pageId);
var myRequest = new Request(pageId + '.txt');
fetch(myRequest, {headers: 'Access-Control-Allow-Origin'})
.then(function(response) {
if (!response.ok) {
throw new Error("HTTP error, status = " + response.status);
}
return response.text();
})
.then(function(text) {
console.log(text);
})
.catch(function(error) {console.error(error)});
}