• 原始的ajax操作


    var xmlHttp = null ;
            //创建XMLHttpRequest对象
            function createXMLHttp() {
                if (typeof XMLHttpRequest != "undefined") //针对非IE浏览器
                {
                    xmlHttp = new XMLHttpRequest();
                }
                else if (window.ActiveXObject)//针对IE浏览器 
                {
                    var aVersions = ["Msxml2.XMLHttp.5.0", "Msxml2.XMLHttp.4.0", "Msxml2.XMLHttp.3.0", "Msxml2.XMLHttp", "Microsoft.XMLHttp"];
                    for (var i = 0; i < aVersions.length; i++) {
                        try {
                            xmlHttp = new ActiveXObject(aVersions[i]);
                            break;
                        }
                        catch (e)
            { }
                    }
                }
            }
     
            function sendRequest() {
    //……
                 createXMLHttp(); //0
                // alert(xmlHttp.readyState);
                 xmlHttp.onreadystatechange = function () {
                     // alert(xmlHttp.readyState);
                     if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
                         //得到响应流
                         var result = xmlHttp.responseText;
                         sp.innerHTML = result;
    }
                     }
                 };
                 //注意谓词 最好大写
                 xmlHttp.open("GET", url, true); //连接服务器 readyState  0>1
                 xmlHttp.send(null); //发送请求1>2  >>>3 参数 发送的数据(post提交)
             }
            
  • 相关阅读:
    拉丁舞身形研究之恰恰恰
    和我们一起建设中文最专业的GPU站点——OpenGPU.org
    Signal Shading Theory?
    GPGPU实时光线刻蚀模拟
    Geometry Shader Concepts & Examples
    基于GPU屏幕空间的精确光学折射效果
    宽容
    我的相册
    Ninject 笔记之 对象范围 Kevin
    Attempt to write to a readonly database Sqlite Kevin
  • 原文地址:https://www.cnblogs.com/hui1107464497/p/4502156.html
Copyright © 2020-2023  润新知