try event.preventDefault fix

This commit is contained in:
Arthur Lu 2022-12-12 15:10:52 -08:00
parent ce4bf30e4b
commit 3abd62773d

View File

@ -4,10 +4,11 @@ window.addEventListener("DOMContentLoaded", init);
function init (){
let formSubmitButton = document.querySelector("#submit");
formSubmitButton.addEventListener("click", loginFormSubmitHandler);
formSubmitButton.addEventListener("click", loginFormSubmitHandler(e));
}
async function loginFormSubmitHandler () {
async function loginFormSubmitHandler (e) {
e.preventDefault();
let form = document.querySelector("form");
let formData = new FormData(form);
try {