18 lines
406 B
JavaScript
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
|
|
}
|