iching-broker-level2/frontend/event.ts

29 lines
944 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-14 08:01:35 +00:00
//fetch("http://192-168-197-2.c-one-infra.de:8090/api/command", { method: "POST" })
2025-04-04 09:48:30 +00:00
2025-04-14 08:01:35 +00:00
fetch("/iching/api/command", { method: "POST" })
2025-04-09 13:47:06 +00:00
.then(res => res.text())
2025-04-11 10:34:35 +00:00
.then(text => console.log("Server sagt:", text))
.catch(error => console.error("Fehler:", error));
2025-04-11 13:11:28 +00:00
}
document.addEventListener("DOMContentLoaded", () => {
const button = document.getElementById("myButton");
button?.addEventListener("click", handleClick);
});
2025-04-11 09:05:48 +00:00
2025-04-14 08:01:35 +00:00
//fetch("http://localhost:8090/api/command", {
//fetch("/api/command", {
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-11 13:11:28 +00:00
.then(text => console.log("Server sagt:", text)); */