refresh = () => response = fetch('http://127.0.0.1:5500/') .then((response) => { return response.text(); }) ConnectionTest = async () => { var a = await refresh(); //delete(response) console.log(a) document.getElementById("BotStatus").innerHTML = a; return a } async function myFunction() { var connectionStatus = await ConnectionTest(); document.getElementById("BotStatus").innerHTML = connectionStatus; } myFunction();