29 lines
No EOL
944 B
TypeScript
29 lines
No EOL
944 B
TypeScript
function handleClick(): void {
|
|
console.log("Der Button wurde geklickt!");
|
|
alert("Hallo von TypeScript!");
|
|
|
|
fetch("/iching/api/command", { method: "POST" })
|
|
.then(res => res.text())
|
|
.then(text => console.log("Server sagt:", text))
|
|
.catch(error => console.error("Fehler:", error));
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
const button = document.getElementById("myButton");
|
|
button?.addEventListener("click", handleClick);
|
|
});
|
|
|
|
|
|
|
|
//fetch("http://192-168-197-2.c-one-infra.de:8090/api/command", { method: "POST" })
|
|
|
|
//fetch("http://localhost:8090/api/command", {
|
|
//fetch("/api/command", {
|
|
|
|
/*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)); */ |