springMVC中ajax的实现
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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; }
以上是关于springMVC中ajax的实现的主要内容,如果未能解决你的问题,请参考以下文章
html PHP代码片段: - AJAX基本示例:此代码演示了使用PHP和JavaScript实现的基本AJAX功能。
SpringMVC 从入门到精通系列 05——Ajax的实现方式总结