iching-broker-level2/frontend/event.js
Christopher Hase c0f1a3db7e
Some checks are pending
ci / build (push) Waiting to run
add http-server part 6.2
2025-04-10 14:36:39 +02:00

15 lines
600 B
JavaScript

"use strict";
function handleClick() {
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);
});