zoukankan      html  css  js  c++  java
  • 登陆记录用户名和密码

    $(function() {     
        $('#login').on('click', function() { 
            var username = $('#username').val(); 
            var password = $('#password').val(); 
            if (username == '' || password == '') 
            { 
                alert('账号或密码不能为空'); 
                return ; 
            }
            var params = {'username':username, 'password':password}; 
            XZ_SSO_Controller.login(params, function(data)
            {
                if(data.flag == 0)
                { 
                    if(window.localStorage){
                        window.localStorage["lastcontact"] = $("#username").val() + "|" + $("#password").val()
                    }
                    var redirect_url = _GET['redirect'] ? _GET['redirect'] : (_GET['done'] ? _GET['done'] : '<?php echo $this->createAbsoluteUrl('home/index');?>'); 
                    window.location.href = redirect_url; 
                }else{ 
                    alert('用户名或密码错误!'); 
                } 
            }, 'script'); 
    
    //退出 
    //XZ_SSO_Controller.logout('script'); 
        })
    
        if(window.localStorage && window.JSON && window.localStorage["lastcontact"]){
           var data = window.localStorage["lastcontact"].split("|");
           if(data && data.length > 1){    
                  data[0] && $("#username").val(data[0]);
                  data[1] && $("#password").val(data[1]);
           }    
        }
    
    }) 
    </script> 
  • 相关阅读:
    JS操作JSON总结
    jQuery对select操作
    MS SQL GUID
    QT延时方法
    MySQL 实践
    MySQL 入门教程
    asp.net获取URL和IP地址
    C#-foreach与yield
    C#—序列化(Serialize)和反序列化(NonSerialize)
    Newtonsoft.Json序列化和反序列
  • 原文地址:https://www.cnblogs.com/jami918/p/3517064.html
Copyright © 2011-2022 走看看