• Ajax 传统的异步登陆


         这是一个传统的异步登陆,利用Ajax实现的,主要代码如下:

            客户端代码:

            var http;

            function Button1_onclick() {

                if (window.ActiveXObject) {

                    http = new ActiveXObject("Microsoft.XMLHTTP");

                }

                else {

                    if (window.XMLHttpRequest) {

                        http = new XMLHttpRequest();

                    }

                    else {

                        alert("初始化失败!");

                    }

                }

                var sname = form1.Text1.value;      //用户名

                var spwd = form1.TextBox2.value;   //密码

                var url = "hide.aspx?name=" + sname + "&pwd=" + spwd + "";   //执行页,以及传参

                url=encodeURI(url);    //对url进行编码

                http.onreadystatechange = Fun;

                http.open("Get", url);

                http.send(null);

            }

            function Fun() {

                if (http.readyState == 4) {

                    var r = http.responseText;

                    alert(r);

                }

            }

          

           服务器:(这些放在Form Loading事件中)

                string sname = Request .QueryString ["name"];

                string spwd = Request .QueryString ["pwd"];

     

                string r = Isexist(sname, spwd);    //用户名、密码验证的方法调用

     

                Response.Clear();

                Response.Write(r);

                Response.End();

  • 相关阅读:
    牛客网-湘潭大学校赛重现H题 (线段树 染色问题)
    bzoj 2243: [SDOI2011]染色 (树链剖分+线段树 区间合并)
    SPOJ QTREE2 (LCA
    Neo4j-Cypher
    MySQL避免插入重复记录:唯一性约束
    python ftp教程
    Neo4j 导入 CSV 文件
    jupyter notebook 安装 jupyter_contrib_nbextension
    python 性能分析(时间,空间)之 line_profiler 模块 ,memory_profiler的使用
    hive 自定义函数
  • 原文地址:https://www.cnblogs.com/shuaichao/p/3168552.html
Copyright © 2020-2023  润新知