var fastAJax = function(args) {
    var xmlhttp = null;
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    if (xmlhttp == null) {
        args.handler("notSupport");
    } else {
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4) {
                if (xmlhttp.status == 200) {
                    args.handler(xmlhttp.responseText);
                } else {
                    args.handler(xmlhttp.statusText);
                }
            }
        };
        xmlhttp.open(args.type,args.url, true);
        xmlhttp.send(args.data);
    }
};
版权声明:本文为李维亮博主的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:http://www.liweiliang.com/797.html

标签: ajax

评论已关闭