Mootools的:如何重定向如果AJAX请求返回重定向code?

编程入门 行业动态 更新时间:2024-10-12 08:18:22
本文介绍了Mootools的:如何重定向如果AJAX请求返回重定向code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要重定向用户是否请求返回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?

本文发布于:2023-07-14 20:04:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1106707.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   Mootools   code   AJAX

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!