iching-broker-level3/frontend/event.ts

22 lines
736 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-11 09:05:48 +00:00
fetch("http://localhost:8090/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));
2025-04-11 09:05:48 +00:00
/*fetch("/api/command", { method: "POST" })
.then(res => res.text())
.then(text => console.log("Server sagt:", text));*/
2025-04-10 06:57:08 +00:00
/*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);
});