Here is my Ajax code:
var email="abc@abc.com";
$.ajax({
url : "ships",
data : "{email" + email.toString() + "}",
success : function(data){
alert(data)
},
error : function(data) {
console.log("error:", data);
},
type : "post"
});
And here is my Java Servlet code:
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
System.out.println(request.getParameter("email"));
}
I CANNOT read data in Java Servlet The console prints out the following value for email:
null
I am using Tomcat 7
Can anyone please tell me what i am doing wrong and why i cannot read data in Java Servlet_