同样的$.ajax()调用两次,在IE8下只进入一次Action
functionsaverole(){varrolename=$("#rolename_xiao").val();$.ajax({url:"../UserModuleLi...
function saverole(){
var rolename=$("#rolename_xiao").val();
$.ajax({url:"../UserModuleList_searchRole?rolename="+encodeURI(encodeURI(rolename)),
async:false,
success: function(msg){
if(msg=="abcd"){
alert(msg);
saveroles();
}else{
alert('角色名称已存在');
$("#rolename_xiao").focus();
return ;
}
}
});
}
function saveroles(){
var rolename=$("#rolename_xiao").val();
alert(rolename);
rolename=rolename.replace(/\s+/g,"");
var usergroupid_xl = $("#usergroupid_xl").val();//登录用户groupclass
rolename = encodeURI(encodeURI(rolename));
var url = "../UserModuleList_saveRole?rolename="+rolename+"&superioRid="+usergroupid_xl;
$.ajax({url:url,
async:false,
success:function(res){
alert(res);
if(res.toString()=="false"){
alert("创建角色失败!");
return;
}else{
check(rolename);
UserModuleInitBody();//角色和权限树形菜单加载
}}
});
_userdialog.close();
}
function check(rolenames){
alert(rolenames);
$.post("../UserModuleList_searchRole?rolename="+rolenames,
function(obj){
alert(obj);
$("#managerid_zhangbo").val(obj);
var a=$("#fenpeiquanxian_zhangbo_gray").length;
if(a==0){
newManager();
}else{
alert("添加角色成功");
return;
}
});
}
我在Action中打印出了传进方法的参数 错误的:
正确的: 展开
var rolename=$("#rolename_xiao").val();
$.ajax({url:"../UserModuleList_searchRole?rolename="+encodeURI(encodeURI(rolename)),
async:false,
success: function(msg){
if(msg=="abcd"){
alert(msg);
saveroles();
}else{
alert('角色名称已存在');
$("#rolename_xiao").focus();
return ;
}
}
});
}
function saveroles(){
var rolename=$("#rolename_xiao").val();
alert(rolename);
rolename=rolename.replace(/\s+/g,"");
var usergroupid_xl = $("#usergroupid_xl").val();//登录用户groupclass
rolename = encodeURI(encodeURI(rolename));
var url = "../UserModuleList_saveRole?rolename="+rolename+"&superioRid="+usergroupid_xl;
$.ajax({url:url,
async:false,
success:function(res){
alert(res);
if(res.toString()=="false"){
alert("创建角色失败!");
return;
}else{
check(rolename);
UserModuleInitBody();//角色和权限树形菜单加载
}}
});
_userdialog.close();
}
function check(rolenames){
alert(rolenames);
$.post("../UserModuleList_searchRole?rolename="+rolenames,
function(obj){
alert(obj);
$("#managerid_zhangbo").val(obj);
var a=$("#fenpeiquanxian_zhangbo_gray").length;
if(a==0){
newManager();
}else{
alert("添加角色成功");
return;
}
});
}
我在Action中打印出了传进方法的参数 错误的:
正确的: 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询