Removed event parameter from function so that it could be used with the HTML form 'onsubmit'

master
Aadhavan Srinivasan 1 year ago
parent e5bdf2cc2c
commit 536af5f9c5

@ -1,7 +1,7 @@
const submit = document.getElementById("button");
submit.addEventListener('click', validate);
function validate(e) {
e.preventDefault();
//const submit = document.getElementById("button");
//submit.addEventListener('click', validate);
function validate() {
// e.preventDefault();
const url = document.getElementById("URL");
const glink = document.getElementById("GLink");
@ -48,7 +48,13 @@ function validate(e) {
error.setAttribute('aria-hidden', true);
error.setAttribute('aria-invalid', false);
console.log("Valid");
return valid;
return valid;
/* var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET','result.php',true);
xmlhttp.send();
console.log(xmlhttp.responseText);*/
} else {
/*flag*/
@ -62,6 +68,7 @@ function validate(e) {
url.classList.add("invalid");
error.setAttribute('aria-hidden', false);
error.setAttribute('aria-invalid', true);
return false;
}
}
}

Loading…
Cancel
Save