text-display/public/js/main.js
2023-02-16 13:30:06 +01:00

18 lines
406 B
JavaScript

!async function(){
let data = await fetch("http://localhost:8000/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
}