Changed the file system to a more ordered state and updated links in files accordingly. Also the reffering to files is now uniform
22 lines
677 B
JavaScript
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!";
|
|
}
|
|
});
|