20 lines
661 B
JavaScript
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";
|
|
});
|
|
});
|