我需要重定向用户是否请求返回302或303似乎没有一个标准的方式来做到这一点(奇怪的,我认为这是一个相当常见的任务)。
I need to redirect user if request returns 302 or 303. It seems that there isn't a standard way to do this (odd, I thought it's quite a common task).
我有这个code:
var request = new Request({ url: "/some-url/", method: 'get', evalScripts: true, onComplete: function(){ console.log(this.status); } });
控制台打印0状态,但网页检查显示状态code为302发现,所以我不能手动检查code和重定向。任何人都知道我在做什么错了?
Console prints 0 status but web inspector shows that the status code is 302 Found, so I can't manually check the code and get redirected. Anyone know what I'm doing wrong?
感谢。
推荐答案通常情况下,一个Ajax请求到301/302/303等将按照新的位置和再-issue要求按规格。如果您没有看到第二个请求,什么是错的,就像一个无限循环或类似的...
normally, an ajax request to a 301/302/303 etc will follow the new location and re-issue the request as per specification. if you are not seeing a second request, something is wrong, like an infinite loop or similar...
更此处的dev.w3/2006/webapi/XMLHtt$p$pquest/#infrastructure-for-the-send-method
更多推荐
Mootools的:如何重定向如果AJAX请求返回重定向code?
发布评论