ajax不能跳转页面,需要传递Message来决定结果
来源:互联网 发布:淘宝店怎么改名字 编辑:程序博客网 时间:2024/05/22 15:51
@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;
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");
}
});
});
@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");
}
});
});
0 0
- ajax不能跳转页面,需要传递Message来决定结果
- ajax如何实现页面局部跳转与结果返回
- struts2 要跳转到得页面是根据action处理结果的变量决定的
- AJAX扩展-POST传递参数并跳转页面
- angularjs项目需要从一个页面跳转到另一个页面,同时需要传递一个参数
- angularjs项目需要从一个页面跳转到另一个页面,同时需要传递一个参数。
- 跳转页面传递参数
- ajax页面实现跳转
- AJAX跳转页面
- ajax执行页面跳转
- 页面跳转 传递中文问题
- Android 页面跳转 传递参数
- thinkphp 页面跳转传递参数
- 页面跳转与数据传递
- 页面跳转和数据传递
- 页面跳转并传递数据
- 页面跳转和数据传递
- html页面跳转传递参数
- 安装android驱动解决device not found
- 算法导论12.2查询二叉搜索树 练习总结
- 网络编程_post_异步-代理_获取网络数据
- 采样频率Hz 采样率KSPS或MSPS,两种单位的换算关系
- Android常用组件——定制化的SwipeListView
- ajax不能跳转页面,需要传递Message来决定结果
- linux定时任务的设置
- 第二十二篇:UITableView练习代码
- 网络编程_post_异步-请求_获取网络数据
- No2地图 MapKit框架
- NDK调试
- 架构之路(一):目标
- showModelessDialog() 详解
- 单例模式