Auto oppdatering hvert 5. sekund

This commit is contained in:
Trygve 2024-10-08 21:41:05 +02:00
parent 6c5adf546c
commit 0fc2aa5f05

View File

@ -1,6 +1,10 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="no"> <html lang="no">
<head> <head>
<meta charset="UTF-8" />
<title>EKT</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="description" content="Elektronisk Kadaver Tidtakningssystem" />
<link rel="stylesheet" href="https://matcha.mizu.sh/matcha.css"> <link rel="stylesheet" href="https://matcha.mizu.sh/matcha.css">
</head> </head>
<body> <body>
@ -14,4 +18,16 @@ include("get_table.php")
</tbody> </tbody>
</table> </table>
</body> </body>
<script>
function update() {
const table = document.querySelector("table");
const myRequest = new Request(`get_table.php`);
fetch(myRequest)
.then((response) => response.text())
.then((text) => {
table.innerHTML = text;
});
}
setInterval(update, 5*1000)
</script>
</html> </html>