0
我正在使用jQuery Ajax发出GET请求。有时候它可以很好地工作,但有时我看到chrome开发工具控制台时会禁止403。这是服务器问题还是我的代码?对服务器的HTTP GET请求只能偶尔工作
当我登录时,我从服务器获取加密的密码,用户名和ID。然后我将它存储在LocalStorage
中,因为我试图在另一个页面上工作的请求。我还需要使用AES加密从这些字段中创建客户端令牌。为此,我使用CryptoJS
。对于我的请求,我需要发送从LocalStorage
检索到的密码,用户名,ID和客户端令牌。我意识到这可能不是一个好方法,但我没有控制服务器端。
编辑:这是我的Ajax调用该服务:
$("#system-form").submit(function (e) {
$.ajax({
type: "GET",
url: "myurl",
data: "User.Username=" + localStorage.getItem("guid") + "&User.Password=" + localStorage.getItem("password") + "&User.SecUser=" + localStorage.getItem("secUser") + "&ClientAppID=" + localStorage.getItem("ClientAppId") +"&"+ $(this).serialize(),
})
.done(function(data) {
//parse data
})
.fail(function (xhr, textStatus, error) {
console.log(JSON.stringify(xhr.responseText));
});
e.preventDefault();
});
可能是[jQuery AJAX调用导致错误状态403]的副本(https://stackoverflow.com/questions/36666256/jquery-ajax-call-results-in-error-status-403) – taha
这是这个吗?服务问题或我的代码?' - 是的,可能是其中的一个 –
我已经为我的'ajax'调用添加了代码。 – ecain