PHP header(): 302 Moved Temporarily error
This question already has an answer here:
The response already redirects the AJAX request. It does not change the page the user is currently seeing in the browser. That's the way it is and you cannot change it from within PHP. The AJAX request was executed entirely in the background, that's the point of AJAX. Whatever response the server returns does not directly visibly affect anything on the site that's currently visible to the user. You have to handle the response entirely in Javascript.
If you want to redirect the user to another page based on a failed AJAX response, you'll have to do so in Javascript:
$.ajax(..., function (data) {
if (/* something or other */) {
window.location = /* other page */;
}
});
链接地址: http://www.djcxy.com/p/1958.html
上一篇: 在Ajax请求上更新整个页面
下一篇: PHP标头():302移动临时错误