Post a form after javascript validation

I have prevented the HTML form from submitting through so I can do form validation with JavaScript. My form validation works but I do not know how to submit the form through. How do I submit the form through? I would like to use the POST method to route ‘/login’.

const form = document.getElementById('login');
const email = document.getElementById('email');
const password = document.getElementById('password');

const regexEmail = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,6}$/;

form.addEventListener('submit', (e) => {
    e.preventDefault();
    
    if(checkInputs()) {
        alert('test');
    }
});

/* Validate input from form */
function checkInputs() {

    let emailSuccess = false;
    let passwordSuccess = false;

    if(!validateInput(regexEmail, email.value.trim())) {
        setErrorFor(email, "Invalid email");
        emailSuccess = false;
    }
    else {
        setSuccessFor(email);
        emailSuccess = true;
    }

    if(password.value.length < 6) {
        setErrorFor(password, "Password should be 6 characters or more");
        passwordSuccess = false;    
    }
    else {
        setSuccessFor(password);
        passwordSuccess = true;
    }

    return (passwordSuccess && emailSuccess);  
}

/* Display error message and error icon */
function setErrorFor(input, message) {
    const formControl = input.parentElement;
    const error = formControl.querySelector('.error-message');

    error.className = 'error-message error';
    error.innerText = message;
    formControl.className = 'form-control error'; 
}

/* Display success icon and remove any error message */
function setSuccessFor(input) {
    const formControl = input.parentElement;
    const error = formControl.querySelector('.error-message');
    error.className = 'error-message';
    formControl.className = 'form-control success';
}

/* Validate user input - regexpression match */
function validateInput(regex, input) {
    return regex.test(input);
}

Answer

e.preventDefault(); prevents the form from submitting and you are always doing that.

Only do that if validation fails.

i.e. if (!checkInputs())