This repository has been archived on 2025-05-16. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
pi-race-timer/app/static/js/zuordnen.js
2025-04-29 23:36:37 +02:00

20 lines
661 B
JavaScript

document.getElementById("zuordnungForm").addEventListener("submit", function(e) {
e.preventDefault();
const zuordnungen = [];
document.querySelectorAll(".zuordnung").forEach(row => {
const zeit = row.querySelector("span").innerText;
const fahrer = row.querySelector("select").value;
if (fahrer) {
zuordnungen.push({ zeit: zeit, fahrer: fahrer });
}
});
fetch("/zeit_zuordnen", {
method: "POST",
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ zuordnungen: zuordnungen })
}).then(() => {
window.location.href = "/ergebnis";
});
});