
正文
ajax方法携带授权标识
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
$.ajax({
type: "post",
url: "/api/login",
data: { username: getusername, password: getuserpwd,client:getclient },
dataType: "json",
xhrFields: {
withCredentials: true
},
//contentType: 'application/json; charset=utf-8', //客户端(浏览器)解码方式
success: function (data) {
if (data.success) { $("form").submit(); } else {
$("#lblerror").text(data.message);
$("#btnSubmit_login").removeClass("disabled").val("登 录");
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(errorThrown);
}
});
方法中添加
xhrFields 属性







