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

前端之家收集整理的这篇文章主要介绍了ajax不能跳转页面,需要传递Message来决定结果前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_502_0@@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;

@H_502_0@}

$("#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"); } }); }); 原文链接:https://www.f2er.com/ajax/162873.html

猜你在找的Ajax相关文章