本帖最后由 txiaohu 于 2013-12-9 14:05 编辑
[C#] 纯文本查看 复制代码 m_szUserPwdValue = Base64.encode($("#loginUserName").val() + ":" + $("#loginPassword").val());
$.ajax({
type: "get",
url: m_lHttp + m_szHostName + ":" + m_lHttpPort + "/PSIA/Custom/SelfExt/userCheck",
async: true,
timeout: 15000,
beforeSend: function(xhr) {
xhr.setRequestHeader("If-Modified-Since", "0");
xhr.setRequestHeader("Authorization", "Basic " + m_szUserPwdValue);
},
success: function(xmlDoc, textStatus, xhr) {
if("200" === $(xmlDoc).find("statusValue").eq(0).text()) {
var szUrl = decodeURI(document.URL);
if(szUrl.indexOf("?page=") != -1) {
var szPage = szUrl.substring(szUrl.indexOf("page=") + 5, szUrl.indexOf("¶ms="));
if(szPage.indexOf(".asp") == -1) {
szPage = szPage.concat(".asp");
}
var szParam = szUrl.substring(szUrl.indexOf("¶ms=") + 8, szUrl.length);
$.cookie("page", szPage + "?" + szParam + "%1");
} else {
$.cookie("page", null);
}
$.cookie("userInfo" + m_lHttpPort, m_szUserPwdValue);
window.location.href = "main.asp";
} else {
$("#loginUserName").focus();
$("#loginUserName").val("");
$("#loginPassword").val("");
alert(translator.translateNode(g_lxdLogin, "LoginTips4"));
}
},
error: function(xhr, textStatus, errorThrown) {
if("timeout" == textStatus) {
alert(translator.translateNode(g_lxdLogin, "ConnectTimeoutTips"));
} else {
alert(translator.translateNode(g_lxdLogin, "NetworkErrorTips"));
}
}
});
}
|