ajax 发送post请求传参给SpringMVC

来源:互联网 发布:阿里云备案域名介入 编辑:程序博客网 时间:2024/05/17 02:36
function addNewPrice() {var data = {};data.revitAddInId = $("#revitAddInId").val();data.period = $(".periodSelector").val();data.money = $("#money").val();if (data.money.length==0 || isNaN(data.money)){alert("钱不能为空,且要为数字");return false;}data.srevitAddInName = $(this).data("name");//datas.push(data);//console.log(JSON.stringify(datas));$.ajax({url : ctx + '/revitAddIn/addPrice.html',type : "POST",contentType : "application/json",data : JSON.stringify(data),dataType : 'json',success : function(data) {if (data.success) {location.href =ctx+ "/XX/enterPriceEdit.html?reivtAddInId="+$("#revitAddInId").val()+"&revitAddInName="+$("#revitAddInName").val();}}}); 
后端使用requestbody 对象接收
0 0
原创粉丝点击