我正在使用AJAX获取令牌密钥,然后转移到另一个页面以检查令牌访问密钥是否已生成。这是我的代码。我收到的错误是“错误的请求状态”。
function Login() {
var mod = {
UserName: $("#name").val(),
Password: $("#pass").val(),
grant_type: 'password'
}
$.ajax({
url: '/token',
method: 'Post',
data: JSON.stringify(mod),
contentType: 'application/x-www-form-url;',
success: function(response) {
sessionStorage.setItem('accessToken', response.access_token);
window.location.href = "Data.html";
},
error: function(response) {
}
})