Am getting form data in console.log
$('#save').on('click',function(){
alert("test");
var data = $('form').serialize();
console.log("data"+data);
$.ajax({
type: "POST",
url: "saveExpenses",
data: $('form').serialize(),
cache: true,
success: function(data){
alert("Success");
}
})
})
and the controller:
@RequestMapping(value="/saveExpenses",method=RequestMethod.POST)
public String saveExpense(ExpensesSummary expenses, HttpServletRequest request,HttpSession session){
System.out.println("first name"+expenses.getFirstName());
String message = homeBankingDao.expenseSummary(expenses);
request.getSession().setAttribute("message",message);
return "login";
}
but am getting 400 bad request error.can anyone help me out in this..