mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-05-14 01:21:49 +00:00
22 lines
713 B
JavaScript
22 lines
713 B
JavaScript
const registerForm = document.getElementById("register-form");
|
|
const confirmPassword = document.getElementById("confirmPassword");
|
|
|
|
registerForm.addEventListener("submit", (event) => {
|
|
event.preventDefault();
|
|
const formData = new FormData(registerForm);
|
|
|
|
const data = {};
|
|
formData.forEach((value, key) => data[key] = value);
|
|
|
|
fetch(registerForm.getAttribute("action"), {
|
|
method: registerForm.getAttribute("method"),
|
|
headers: {"Content-Type": "application/json"},
|
|
body: JSON.stringify(data)
|
|
})
|
|
.then(res => res.json())
|
|
.then(_ => {
|
|
window.location.href = "./login"
|
|
})
|
|
.catch(error => console.error("Error: " + error))
|
|
});
|