zoukankan      html  css  js  c++  java
  • Ajax代码

    function GetXmlHttpObject() {
        var xmlHttp = null;
        try {
            // Firefox, Opera 8.0+, Safari
            xmlHttp = new XMLHttpRequest();
        }
        catch (e) {
            // Internet Explorer
            try {
                xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e) {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
        return xmlHttp;
    }

    function GetInfo() {

        var xmlHttp = GetXmlHttpObject();

        if (xmlHttp == null) {
            alert("您的浏览器不支持AJAX!");
            return;
        }

        var keystr = document.getElementById("keyword").value;

        var url = "InfoService.aspx";
        url += "?key=" + encodeURI(keystr);
        url += "&type=" + tempType;
        url = url + "&r=" + Math.random();

        xmlHttp.onreadystatechange = function() {
            if (xmlHttp.readyState == 4) {
                //                 try {
                var f = xmlHttp.responseText;
                ShowMsg(f);
                //                 }
                //                 catch (ex) {
                //                     alert("发生意外错误:"+ex);

                //                 }
            }
        };
        xmlHttp.open("GET", url, true);
        xmlHttp.send(null);
    }

  • 相关阅读:
    poj 3278 Catch That Cow(bfs+队列)
    poj 1265 Area(Pick定理)
    poj 2388 Who's in the Middle
    poj 3026 Borg Maze(bfs+prim)
    poj 2485 Highways
    变量引用的错误:UnboundLocalError: local variable 'range' referenced before assignment
    Sysbench硬件基准测试
    Sysbench-OLTP数据库测试
    字典
    操作列表
  • 原文地址:https://www.cnblogs.com/dashi/p/4034765.html
Copyright © 2011-2022 走看看