js表单提交到后台对象接收

时间:2022-08-26 10:05:59
$.extend({
StandardPost:function(url,args){
var form = $("<form method='post' target='_blank'></form>"),
input;
form.attr({"action":url});
$.each(args,function(key,value){
input = $("<input type='hidden'>");
input.attr({"name":key});
input.val(value);
form.append(input);
});
form.appendTo('body').submit().remove();
}
});

 

下单点击按钮触发事件:
$("#btn_test").click(function () {
var data = {
maxQuotationNo:"",
maxPrice:,
salePrice:10000.00,
dealerId:,
buyerId:
};
$.StandardPost('http://***/***/**/toDisposePage', data);
});

后台取值:post 对象接收
@RequestMapping(value = "/printAgreement", method = RequestMethod.POST)
public ModelAndView printAgreement(ModelAndView modelAndView, ReceiptInstallmentVO vo ) {