iching-broker-level2/frontend/event.ts
Christopher Hase ff7bf73e93
All checks were successful
ci / build (push) Successful in 1m23s
add http-server part 8.3 finish
2025-04-14 11:24:56 +02:00

14 lines
467 B
TypeScript

function handleClick(): void {
console.log("Der Button wurde geklickt!");
//alert("Hallo von TypeScript!");
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);
});