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; }
作者:Tyler Ning
出处:http://www.cnblogs.com/tylerdonet/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,如有问题,请微信联系冬天里的一把火