text-display/public/js/main.js

19 lines
405 B
JavaScript
Raw Permalink Normal View History

2023-02-16 12:30:06 +00:00
!async function(){
2023-02-16 13:35:42 +00:00
let data = await fetch(location.protocol + "/api")
2023-02-16 12:30:06 +00:00
.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
}