Object generated from form and url

Signed-off-by: Eoghan Conlon <eoghanconlon73@skynet.ie>
This commit is contained in:
eoghanconlon73 2023-08-27 16:47:47 +01:00
parent d8591575b1
commit 49a5878460

View file

@ -30,7 +30,11 @@
const formData = new FormData(formEl); const formData = new FormData(formEl);
const pass = formData.get("password"); const pass = formData.get("password");
if(pass === formData.get("confirm")){ if(pass === formData.get("confirm")){
alert("Passwords match"); const url = new URL(window.location.href);
const urlParam = new URLSearchParams(url.search);
const auth = urlParam.get("auth");
const object = {auth: auth, pass: pass };
alert(JSON.stringify(object));
} else { } else {
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure: Passwords don't match</span>"; document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure: Passwords don't match</span>";
} }