[英]redirect to login page in AJAX requests
In my JS code I'm checking for a 403 status code on AJAX response and redirect to login page like this: 在我的JS代码中,我正在检查AJAX响应的403状态代码并重定向到登录页面,如下所示:
$.ajax({
statusCode: {
403: function() {
window.location.href = "/login";
}
}
});
Should I use the full url to my site like the follows: 我应该使用我的网站的完整网址,如下所示:
403: function() {
window.location.href = "www.mysite/login";
}
Or it's enough to use the relative one? 或者它足以使用相对的一个?
使用相对URL应该足够了。
would it be faster to try with relative url to see if it's working than posting here ? 尝试使用相对网址来查看它是否有效而不是发布在这里会更快吗?
I think it will work with relative url 我认为它适用于相对网址
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.