Here is the code snippet I used in JavaScript:
function submit(){
var form = $('#egform').serialize();
alert("before ajax");
$.post("testing.html", form, function(data, status) {
if (data==1) {
alert("Save successful");
} else {
alert("Failed");
}
});
}
And this is my controller code:
@RequestMapping("testing.html")
public @ResponseBody Integer gettestvalue(HttpServletRequest request){
String a=request.getParameter("first");
System.out.println(a);
return 1;
}
However, despite returning 1 from the controller, it is not being received by the JavaScript function. What am I missing?