我在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");
}
})
})
和控制器:
@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";
}
但是我得到了400个错误请求错误。任何人都可以帮助我...