function handleClick(): void { console.log("Der Button wurde geklickt!"); fetch("/iching/api/command", { method: "POST" }) .then(res => res.text()) .then(text => console.log("HTTP-Server says:", text)) .catch(error => console.error("HTTP-Server - Error:", error)); } document.addEventListener("DOMContentLoaded", () => { const button = document.getElementById("myButton"); button?.addEventListener("click", handleClick); });