When you press the submit button first prevent the default form submission, then log all the data in the form to the console.
let formData = new FormData($form); for (let entry of formData.entries()) { console.log(entry); }
let formData = new FormData($form); let data = Object.fromEntries(formData); console.log('data', data);Read the docs here: https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData