What is the 302 error code that jQuery AJAX is throwing?

梦想的初衷 提交于 2019-12-03 23:23:16

问题


I'm working with ASP.NET MVC and jQuery and I have a UserControl that is repeated on every page. In every page request, an AJAX callback occurs. So far so good.

But when I'm in localhost and I publish the site, I notice that this AJAX is throwing a 302 error. This only occurs on https pages, and only in FF and Chrome. On IE, the AJAX request works fine.

What is this 302 error? Why does it only occur on https pages, and only in FF and Chrome?


回答1:


HTTP 302 is used for redirection. My guess is that there is some sort of server error and you are being redirected to an error page using 302. Check the server logs for errors.




回答2:


See How to manage a redirect request after a jQuery Ajax call for an in-depth discussion about the 302 issue.

EDIT:

Here are some other stackoverflow posts on the subject.

How to get jQuery.ajax response status?

Catching 302 FOUND in JavaScript

HTTP redirect: 301 (permanent) vs. 302 (temporary)




回答3:


HTTP code 302 represents a redirection. The server is trying to tell you to redirect somewhere.

http://en.wikipedia.org/wiki/HTTP_302




回答4:


Does the server you accessing has Page Redirection facility? and that the page you access by Ajax was redirected to another page? If that is the case, you'd disable the redirection(at least ignore redirection for that page) then give it a try. PS: I think Ajax may not support url redirection.



来源:https://stackoverflow.com/questions/1473486/what-is-the-302-error-code-that-jquery-ajax-is-throwing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!