/*------ setCookie(name,value) -----------*/

function setCookie(name,value)

{

var Days = 30; //此 cookie 将被保存 30 天

var exp = new Date();

exp.setTime(exp.getTime() + Days*24*60*60*1000);

document.cookie = name + "="+ escape (value) + ";expires=" + exp + ";path=/";

}

/*-------- getCookie(name) ----------*/

function getCookie(name)

{

var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));

if(arr !=null) return unescape(arr[2]); return null;

}

$(function(){

if($("#header")[0]){

setCookie("currentUrl", window.location.href);

}

})

调用

var currentUrl = getCookie('currentUrl');

setCookie("currentUrl", "");

$.ajax({

type: "post",

url: "/Ajax/User.ashx",

data: { "method": "Login", "username": $(".phoneNum").val(), "password": password, "Check_Pwd": $('#check').is(':checked') },

success: function (text) {

if (text == "error") {

$(".pwd").focus().tips({

bg:'#1193f6',

msg: '用户名或密码错误~'

});

}

else if (text == "error1") {

$(".phoneNum").focus().tips({

bg:'#1193f6',

msg: '该用户已被禁用~'

});

}

else if(text == "success") {

if (currentUrl != "" && currentUrl != null) {

window.location.href = currentUrl;

} else {

window.location = '/index';

}

}

}

});

登录成功返回登录前页面js代码的更多相关文章

  1. SpringSecurity兑现多登录成功页面和登录成功返回被拦截界面

    SpringSecurity实现多登录成功页面和登录成功返回被拦截界面 使用SrpingSceurity作为认证和授权的安全框架可以省下很多基础工作. 具体可以参考SpringSecurity,这里不 ...

  2. python小练习--模拟用户登录,(3次重试机会,登录成功展示登录账号密码)

    知识点使用:1.格式化输出的两种方法---% .formate 2.while循环的使用,及跳出循环的两种方法---break(跳出循环体).continue(结束本次循环,继续下次循环) 3.if条 ...

  3. asp.net使用session完成: 从哪个页面进入登录页面,登录成功还回到那个页面

    1.在Login.aspx页面Load中加入 if (!IsPostBack && Request.UrlReferrer != null) {      Session[ " ...

  4. 后台返回json字符串 页面js报错 Uncaught SyntaxError: Unexpected identifier

    后台json字符串是 [{"name": "报销申请", "id": "start"}, {"name&quo ...

  5. struts2登录后返回登录前的页面

    在Action中添加 String getUrl() { return ServletActionContext.getRequest().getHeader("referer") ...

  6. [web前端] react router4.0 登录后返回之前浏览页面(回到来源页)

    本文链接:https://blog.csdn.net/zeroyulong/article/details/81911704困扰了好久的问题,最终还是在官方文档上找到了答案(看英文文档真心难受啊~~) ...

  7. 在Java web项目中防止用户注销后使用浏览器中的“后退”按钮返回注销前页面

    一背景 公司安全整改, 要求:系统中对于关键业务操作应确保使用浏览器"后退"功能无法回到上一步操作界面. 提供:凭证提供所有被检查系统关键业务操作后回退视频,视频显示关键业务操作后 ...

  8. jsp打印页面 js代码

    function doPrint() { bdhtml=window.document.body.innerHTML; sprnstr=""; //开始打印标识字符串有17个字符 ...

  9. 当前页面js代码

    <script type="text/javascript"> var url = location.href; $(function(){ var url = loc ...

随机推荐

  1. java利用过滤器实现编码的转换,内容输出的替换

    在页面建个表单 <form action="login.do" method="post"> <input type="text&q ...

  2. Delphi Socket 阻塞线程下为什么不触发OnRead和OnWrite事件

    //**********************************************************************************//说明: 阻塞线程下为什么不触 ...

  3. Need help with design ReadOnlyListBase (Insert, Update, Delete from ReadOnlyListBase)

    原文地址:http://forums.lhotka.net/forums/p/3166/21214.aspx My task is: For select client, I have a modal ...

  4. 安装配置opensips

    opensips提供了一个视频教程(这个页面有下载链接,90M),参考教程 wget http://opensips.org/pub/opensips/1.9.1/src/opensips-1.9.1 ...

  5. 在iis中注册.net framework

    首先定位到文件夹:cd C:\Windows\Microsoft.NET\Framework\v4.0.30319 执行命令:aspnet_regiis.exe -i

  6. T4 模板的调试方法,方便大家遇到问题自己快速定位和优化

    T4 模板的调试方法,方便大家遇到问题自己快速定位和优化 :1. .ttinclude文件的第一行修改为 <#@ template language="C#" debug=& ...

  7. js控制TR的显示隐藏

    在很多现实的场景中,有的文本框我们希望在选择“是”的按钮之后才出现,这就需要js控制TR的隐藏和显示,如何控制,本文为大家揭晓 下文分享的一段代码:选择是的按钮就显示身高和体重的文本框的代码.注意:r ...

  8. 为什么要使用Spark?

    现有的hadoop生态系统中存在的问题 1)使用mapreduce进行批量离线分析: 2)使用hive进行历史数据的分析: 3)使用hbase进行实时数据的查询: 4)使用storm进行实时的流处理: ...

  9. Codeforces Round #218 (Div. 2) C. Hamburgers

    C. Hamburgers time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  10. Android开发-API指南-Content Provider

    Content Providers 英文原文:http://developer.android.com/guide/topics/providers/content-providers.html 采集 ...