refresh = () => response = fetch('http://127.0.0.1:5500/') .then((response) => { return response.text(); }) ConnectionTest = async () => { var a = await refresh(); console.log(a) return a } async function BotStatus() { var connectionStatus = await ConnectionTest(); document.getElementById("BotStatus").innerHTML = connectionStatus; } BotStatus(); fetch_GetList = (fetchURL) => response = fetch(fetchURL) .then((response) => { return response.text(); }) GetList = async (listType) => { if (listType == "Chyron") { encodedString = encodeURIComponent({ 'request_name': "Chyron", 'request_type': "list" }) targetURL = 'http://127.0.0.1:5500/api/v1/user_client/get?' + encodedString var a = await fetch_GetList(targetURL); console.log(a); return a } else { return None } } async function GetListChyron() { var returnedList = await GetList("Chyron"); } GetListChyron();