iching-broker-level2/frontend/event.ts

18 lines
583 B
TypeScript
Raw Normal View History

2025-04-04 09:48:30 +00:00
function handleClick(): void {
console.log("Der Button wurde geklickt!");
alert("Hallo von TypeScript!");
2025-04-10 06:57:08 +00:00
fetch("/api/command", { method: "POST" })
2025-04-09 13:47:06 +00:00
.then(res => res.text())
2025-04-10 06:57:08 +00:00
.then(text => console.log("Server sagt:", text));
/*fetch("https://192-168-197-2.c-one-infra.de/api/command", { method: "POST" })
2025-04-09 14:51:26 +00:00
.then(res => res.text())
2025-04-10 06:57:08 +00:00
.then(text => console.log("Server sagt:", text)); */
2025-04-04 09:48:30 +00:00
}
document.addEventListener("DOMContentLoaded", () => {
const button = document.getElementById("myButton");
button?.addEventListener("click", handleClick);
});