url中传递参数,在另一个界面如何接收

例如:
用户登录按钮,登录成功页面跳转,在跳转的URL中传递用户账号参数
JS代码如下:

/**
* 用户登录
*/
function login(){
var userAccount=$("#userAccount").val();
var userPassword=$("#userPassword").val();

if(isNull(userAccount)){
alert("请输入账号!");
$("#userAccount").focus();
$("#userAccount").css("background-color","#990000");
return false;
}

if(isNull(userPassword)){
alert("请输入密码!");
$("#userPassword").focus();
$("#userPassword").css("background-color","#990000");
return false;
}

//登录ajax
$.ajax({
async:false, //同步请求,//默认为true 异步
type:"post",//提交方法
dataType:"json",
url:"../admin/userLoginJsonAction!userLogin",//提交的地址
data:{"userAccount":userAccount,"userPassword":userPassword},//提交的参数
//失败回调函数
error:function(xmlHttp,status,errorThrown){
alert("status:"+status+",error : " + errorThrown);
},
//成功后,回调的函数名
success:function(data){
//alert(data.userList[0].userAccount);
if(isNull(data.userList[0].errorMsg)){
if(!isNull(data.userList[0].userAccount)){
alert("登录成功");
location.href = "adminIndex.jsp?userAccount="+userAccount;//location.href实现客户端页面的跳转
//window.open("adminIndex.jsp");
} else {
alert("账号密码错误");
}
} else {
alert(data.userList[0].errorMsg);
}
}
});
}


在另外一个界面接收用户账号参数,代码如下:

<div id="userInfo" class="">welcome <s:property value="#parameters.userAccount" /> <a href="">退出</a></div>
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值