Files
intecsync/cgi-bin/vorbereitung/apiajax.html
2019-07-29 11:27:01 +02:00

36 lines
1.2 KiB
HTML

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Lenschomode</title>
</head>
<body>
<form>
<label for="laufzeit">Dauer einer Schnensch Aktion</label>
<input id="laufzeit" type="number"></input>
<button id="calc" onclick="calc()" type="button" value="Calculate!">Calc</button>
</form>
<h1 id="lensch"></h1>
<script>
let calcbtn = document.getElementById("calc");
let lensch = document.getElementById("lensch");
let laufzeit = document.getElementById("laufzeit");
function calc() {
let req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (this.readyState === 4 && this.status === 200) {
console.log(this.responseText);
lensch.value = this.responseText;
}
}
req.open("GET", "api.php?n=" + laufzeit.value);
req.send();
}
</script>
</body>
</html>