Ajax访问

function Ajax(url, data, method) {
    var xmlHttp = null;
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    } else {
        var MSXML = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP']
        for (var n = 0; n < MSXML.length; n++) {
            try {
                xmlHttp = new ActiveXObject(MSXML[n]);
                break;
            } catch (e) {
                return;
            }
        }
    }
    var responseText = "";
    xmlHttp.open("post", url, true);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.send(data);
    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4) {
            var responseText = xmlHttp.responseText;
            if (xmlHttp.status != 200)
                return;
            if (typeof (method) === "function") {
                method(responseText);
            }
        }
    }
}

 

function verfiyEmoneyPWD() {
    var pwd = $("#dyqPwd")[0].value;
    var url = "AjaxPages/VerifyIntegrationPwd.aspx?uid=" + document.getElementsByName("Userid")[0].value + "&pwd=" + pwd;
    var result;
    Ajax(url, null, function (responseText) {
        if (responseText == "T") {
            result = true;
        }
        else {
            result = false;
        }
    });
    return result;
}

 

posted @ 2012-11-27 22:54  nd  阅读(435)  评论(0编辑  收藏  举报