springMVC中ajax的实现
function addDebtResult(){ var repayIds=$("#repayIds").val(); var lateFeeDay=$("#repayIds1").val(); var subAdminId1=$("#subAdminId1").val(); if(subAdminId1==null||subAdminId1==""){ alert("未选择催收人员!"); return; } $('#bt_flash').attr('data-dismiss', 'modal'); $.ajax({ type: "post", timeout: 30000, async: false, cache: false, data:{ "repayIds":repayIds, "lateFeeDay":lateFeeDay, "subAdminId":subAdminId1, }, url: "${ctx}/postLoanManageController/addTaskAllocat", success: function(data){ if(data==1){ location.reload(); alert("添加成功!"); }else if(data==3){ alert("请登录!"); window.location.href="${ctx}/admin"; }else{ alert("添加失败"); } } }); }
//催收管理:任务分配-添加分配记录 @ResponseBody @RequestMapping(value="/addTaskAllocat",produces="application/json;charset=UTF-8") public int addTaskAllocat(String repayIds,String lateFeeDay, String subAdminId,HttpServletRequest request){ logBefore(logger,"催收管理:任务分配-添加分配记录"); Admin admin=getCurrentAdmin(request); if(admin==null){ return 0; } int flag = postLoanManageService.addTaskAllocat( repayIds, lateFeeDay, subAdminId,admin); logAfter(logger); return flag; }
List<Province> province= loginService.getProvinceByAreaId(areaId);
返回List对象:JSONArray provinceJson=JSONArray.fromObject(province);
返回对象: JSONObject userJson=JSONObject.fromObject(resultInfo);