I am new with servlet, I want to get the data in the servlet using ajax and jquery. it execute but i did not get data in servlet on the click of the submit button the only error part is execute of ajax my index page is
I am new with servlet, I want to get the data in the servlet using ajax and jquery. it execute but i did not get data in servlet
on the click of the submit button the only error part is execute of ajax my index page is
<html>
<head>
<title>First jQuery Example</title>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
</script>
</head>
<body>
<div align=center>
<form id="myform">
<pre>
Name:
<input type="text" name='name' id='name' />
Email:
<input type='text' name='email' id='email' />
Address:
<input type='text' name='address' id='address'>
<input type='submit' value='submit' id='mysubmit'>
</pre>
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
alert("Onready the page");
$("#myform").on('submit',(function(e){
alert("button clicked");
e.preventDefault();
var name=$("#name").val();
var address=$("#address").val();
var email=$("#email").val();
$.ajax({
url: "reg",
type: "GET",
data:{name:name,email:email,address:address},
contentType: false,
cache: false,
processData:false,
success: function(data){
alert(data);
},
error: function(){
alert("error");
}
});
}));
});
</script>
</body>
</html>