加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ajax不能跳转页面,需要传递Message来决定结果

发布时间:2020-12-16 01:51:05 所属栏目:百科 来源:网络整理
导读:@RequestMapping(value = "/updateEmployeeIntro",method = RequestMethod.POST) @ResponseBody public Message updateEmployeeIntroById(HttpSession session,EmployeeIntroVO employeeIntroVo) { Message msg = new Message(); EmployeeByCodeAndPwdVO emp
@RequestMapping(value = "/updateEmployeeIntro",method = RequestMethod.POST)
@ResponseBody
public Message updateEmployeeIntroById(HttpSession session,EmployeeIntroVO employeeIntroVo) {
Message msg = new Message();
EmployeeByCodeAndPwdVO employee = (EmployeeByCodeAndPwdVO) session.getAttribute("employee");
employeeIntroVo.setEmployeeId(employee.getId());
employeeIntroVo.setUpdator(employee.getId());
employeeIntroVo.setUpdateTime(new Date());
int retNumber = employeeBaseService.updateEmployeeDetail(employeeIntroVo);
if (retNumber > 0) {
msg.setResult(true);
} else {
msg.setResult(false);
}
return msg;

}

$("#submitProcess").on("click",function(event){ event.preventDefault();//使a自带的方法失效,即无法调整到href中的URL(http://www.baidu.com) var serialNumber=$("#serialNumber").val(); var organizationLevelName = $("#organizationLevelName").val(); var employeePosts = $("#employeePosts").val(); var employeeNickName = $("#employeeNickName").val(); var employeeCode = $("#employeeCode").val(); var reason = $("#borrowReason").val(); var borrowMoney = $("#borrowMoney").val(); var applicationDate = $("#applicationDate").val(); var repaymentDate = $("#repaymentDate").val(); //前台检查 if(reason == "" && reason==null) { alert("Apply Reason Can not be empty"); } if(borrowMoney == 0 && borrowMoney == null) { alert("Apply Money Can not be empty"); } if(applicationDate == null) { alert("applicationDate Can not be empty"); } if(repaymentDate == null) { alert("repaymentDate Can not be empty"); } $.ajax({ type: "POST",url: basePath + "workflow/oa/costBorrow/startProcess.htmls",data: { "serialNumber":serialNumber,"organizationLevelName": organizationLevelName,"employeePosts": employeePosts,"employeeNickName": employeeNickName,"employeeCode" : employeeCode,"applicationDate" : applicationDate,"repaymentDate" : repaymentDate,"reason" : reason,"money" : borrowMoney },dataType:"json",success: function(result){ //请求正确之后的操作 // alert(result.msg); // alert("sucess"); if("loginAgain" == result.msg) { setTimeout(function(){ window.location=basePath+"admin/employee/login.htmls"; },100); } else { setTimeout(function(){ window.location=basePath+"workflow/process/start.htmls"; },100); } /* */ },error: function(result){ //请求失败之后的操作 alert("fail"); } }); });

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读