// Login stuff document.querySelector("#login").addEventListener("submit", e => { e.preventDefault(); let formData = new FormData(); formData.append("username", document.querySelector("#username").value); formData.append("password", document.querySelector("#password").value); fetch("login.php", { method: "POST", body: formData }).then(res => res.json().then(json => { if (json.message === "ok") { window.location.href = "search.html"; } else { alert(json.message); } })); });