在ajax请求中检测到重定向?

编程入门 行业动态 更新时间:2024-10-08 10:51:13
本文介绍了在ajax请求中检测到重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想使用jQuery来获取URL,并明确检查它是否响应302重定向,但是不遵循重定向.

I want to use jQuery to GET a URL and explicitly check if it responded with a 302 redirect, but not follow the redirect.

jQuery的$.ajax似乎总是遵循重定向.如何防止这种情况,并在不遵循重定向的情况下看到重定向?

jQuery's $.ajax appears to always follow redirects. How can I prevent this, and see the redirect without following it?

标题为"jquery ajax redirect"的标题存在各种问题,但它们似乎都涉及实现其他目标,而不仅仅是直接检查服务器给出的状态.

There are various questions with titles like "jquery ajax redirect" but they all appear to involve accomplishing some other goal, rather than just directly checking the status that a server gives.

推荐答案

AJAX请求永远没有机会不遵循重定向(即,它必须遵循重定向).可以在此答案中找到更多信息 stackoverflow/a/2573589/965648

The AJAX request never has the opportunity to NOT follow the redirect (i.e., it must follow the redirect). More information can be found in this answer stackoverflow/a/2573589/965648

更多推荐

在ajax请求中检测到重定向?

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

发布评论

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

>www.elefans.com

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