iching-broker-level2/frontend/event.ts
Christopher Hase 0189cc2157
All checks were successful
ci / build (push) Successful in 1m36s
add http-server part 8.5.1
2025-04-14 15:02:31 +02:00

13 lines
431 B
TypeScript

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