How do I send data to a javascript file to a java file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta charset="ISO-8859-1">
<title>new user</title>
</head>
<body>
<script language="javascript" type="text/javascript">
function validate()
{
// get inputs
fname = document.getElementById("fname").value;
lname = document.getElementById("lname").value;
email = document.getElementById("email").value;
phone = document.getElementById("phone").value;
pswd = document.getElementById("paswd").value;
cpswd = document.getElementById("conpswd").value;
country = document.getElementById("Country").value;
//create an empty error message
errors = "";
//check name - It simply needs to exist
if (fname == "")
{
errors += "please supply a name \n";
} // end if
//check email
emailRE = /^.+@.+\..{2,4}$/;
if (email.match(emailRE)){
//console.log("email match");
//do nothing.
} else {
//console.log(“email not a match”);
errors += "please check email address \n";
} // end if
//check phone number
phoneRE = /^\d{10}$/;
if (phone.match(phoneRE)){
//console.log(“phone matches”);
//do nothing
}
else
{
//console.log(“phone problem”);
errors += "please check phone #\n";
} // end phone if
//check for errors
if(pswd==""){
errors +="provide password"
}
if (errors == "")
{
window.location.href="http://localhost:2015/login_page/registerservlet"//process the form
}
else
{
alert(errors);
} // end if
} // end function
</script>
Enter ur Detail:<br/><br/>
<form action="registerservlet" method="post">
First Name:<input type="text" id=" id="><br/>
Last Name:<input type="text" id="><br/>
Last Name:<input type="><br/>
Email:<input type="text" id=" id="><br/>
phone:<input type="text" id="><br/>
Email:<input type="><br/>
password:<input type="text" id=" id="><br/>
Confirm Password:<input type="text" id="><br/>
phone:<input type="><br/>
Country:<select id=" id=">
<option value="india"><br/>
password:<input type="USA" id="America"><br/>
Confirm Password:<input type="ua" id="pak"><br/>
Country:<select id="button">
<option value="submit"> India </option>
<option value="validate()"/></form>
</body>
</html>