text-display/public/js/main.js
2023-02-16 13:35:42 +00:00

18 lines
405 B
JavaScript

!async function(){
let data = await fetch(location.protocol + "/api")
.then((response) => response.text())
.then(data => {
return data;
})
.catch(error => {
console.error(error);
});
console.log(data);
print(data);
}();
function print(data) {
document.getElementById("text").innerText = data
document.getElementById("text").value = data
}