自用ajax的json请求
function singlePriceSubmit(){ var json={}; json["area"]=areaStr1; json["goodCateIdStr"]=goodCateIdStr; var arr=[]; $("#singlePriceId table tbody tr").each(function(){ var cells=this.cells; var json1={}; json1["goodsId"]=cells[0].childNodes[0].id; json1["price"]=$.trim(cells[1].childNodes[0].value); json1["maxPayIntegrateRate"]=$.trim(cells[2].childNodes[0].value); json1["receivableIntegrateRate"]=$.trim(cells[3].childNodes[0].value); arr.push(json1); }); if(!checkData(arr)){ return; } json["arr"]=arr; CommonUtil.showOverlay(); var ajax = new $ax(Feng.ctxPath + "/goodPrice/singlesetprice", function (data) { CommonUtil.hideOverlay(); Feng.info("操作成功!"); $("#singlePriceId").modal("hide"); }, function (data) { CommonUtil.hideOverlay(); Feng.error("操作失败!" + data.responseJSON.message + "!"); }); ajax.set("json",JSON.stringify(json)); ajax.start(); }
java
@RequestMapping(value = "/singlesetprice") @ResponseBody public Object singleSetPrice(@RequestParam(value="json",required=true) String json) { this.iGoodsPriceService.singleSetPrice(json); return SUCCESS_TIP; }