iching-broker-level2/frontend/event.ts
Christopher Hase a7250ef323
All checks were successful
ci / build (push) Successful in 1m5s
add http-server part 6.1
2025-04-10 10:21:29 +02:00

18 lines
No EOL
583 B
TypeScript

function handleClick(): void {
console.log("Der Button wurde geklickt!");
alert("Hallo von TypeScript!");
fetch("/api/command", { method: "POST" })
.then(res => res.text())
.then(text => console.log("Server sagt:", text));
/*fetch("https://192-168-197-2.c-one-infra.de/api/command", { method: "POST" })
.then(res => res.text())
.then(text => console.log("Server sagt:", text)); */
}
document.addEventListener("DOMContentLoaded", () => {
const button = document.getElementById("myButton");
button?.addEventListener("click", handleClick);
});