检测jQuery的$就重定向? [英] Detecting a redirect in jQuery $.ajax?

查看:160
本文介绍了检测jQuery的$就重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用jQuery来得到一个网址,并明确检查它是否与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的 $。阿贾克斯似乎始终遵循重定向。我怎样才能prevent这一点,看看重定向不按呢?

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

有各种问题中包含jQuery的AJAX重定向称号,但他们似乎都涉及到完成一些其他的目标,而不仅仅是直接检查服务器提供的状态。

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请求从未有机会不遵循重定向(即,它必须遵循重定向)。更多信息可以在这个答案 http://stackoverflow.com/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 http://stackoverflow.com/a/2573589/965648

这篇关于检测jQuery的$就重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆