Created
July 4, 2015 02:38
-
-
Save jew3lz/ac274971af1f6f5da0d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url: "login/" + code, | |
type: "get", | |
dataType:"text", | |
beforeSend: function (xhr) { | |
//将账号和密码放入HTTP请求的Header部分 | |
xhr.setRequestHeader("name", name); | |
xhr.setRequestHeader("passwd", passwd); | |
}, | |
//data是服务器返回内容 | |
success: function (msg) { | |
//根据返回的map中的login值判断是否登陆成功 | |
alert(222); | |
var ok = msg.login; | |
if (ok) | |
window.location = "/NETCTOSS/login/toIndex"; | |
else { | |
//登陆未成功将返回的错误信息显示 | |
$('#code_error').html(msg.code_error); | |
$('#error').html(msg.error); | |
//刷新验证码信息 | |
$('#scode').attr("src", "/NETCTOSS/login/getCode"); | |
} | |
}, | |
error: function (XMLHttpRequest, textStatus, errorThrown) { | |
// 通常 textStatus 和 errorThrown 之中 | |
// 只有一个会包含信息 | |
alert(XMLHttpRequest.responseText); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment