在一个AJAX调用,302后面没有 [英] In an AJAX call, 302 is not followed

查看:125
本文介绍了在一个AJAX调用,302后面没有的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery 1.6.2做出POST AJAX请求到一个页面上的同一个域。这页做了302重定向到另一个页面。

I'm using jQuery 1.6.2 to make a POST AJAX request to a page on the same domain. That page does a 302 redirect to another page.

现在,我的本地机器这项工作很好,但我们的生产服务器,重定向从不跟随,并在Chrome检查请求被说成是取消。

Now, on my local machine this work fine but on our production server, the redirect is never followed and in the Chrome inspector the request is said to be 'canceled'.

如果我访问同一页面,而不涉及的javascript,一切工作正常,当我说,AJAX的作品在我的本地机器,但不是在生产服务器上。

If I visit the same page without involving javascript, everything works fine, and as I said the AJAX works on my local machine but not on the production server.

有谁知道什么可能会导致这样?

Does anyone know what might cause this?

有服务器之间的一些差异(OS X,Apache2中,PHP5.3.6,HTTP在本地计算机上,Ubuntu的,Lighttpd的,PHP5.3.3,HTTPS生产),但没有一个对我来说应该使任何区别。

There are some differences between the servers (OS X, Apache2, PHP5.3.6, HTTP on local machine, Ubuntu, Lighttpd, PHP5.3.3, HTTPS on production) but none that to me should make any difference.

推荐答案

原来在重定向code中的错误引起的重定向访问http://,而被请求的页面是https://开头。这使得浏览器拒绝跟随重定向。

Turns out a bug in the redirect code caused the redirect to go to http:// while the page that was requested was https://. That makes the browser refuse to follow the redirect.

这篇关于在一个AJAX调用,302后面没有的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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