Files
ticket_system_nino/js/login.js
sraffauf 77fd4e836b Refactored file system
Changed the file system to a more ordered state and updated links in
files accordingly. Also the reffering to files is now uniform
2026-01-21 17:58:15 +01:00

22 lines
677 B
JavaScript

document.getElementById("loginForm").addEventListener("submit", async function (e) {
e.preventDefault();
const username = document.getElementById("username").value;
const password = document.getElementById("password").value;
const formData = new FormData();
formData.append("username", username);
formData.append("password", password);
const response = await fetch("../php/login.php", {
method: "POST",
body: formData
});
const result = await response.json();
if (result.success) {
window.location.href = "../php/admin.php";
} else {
document.getElementById("errorMsg").innerText = "Login fehlgeschlagen!";
}
});