admin管理员组文章数量:1426480
I have a web page generated with php with a form placed within a div. The form is submitted using Ajax and validated on the server side. If there is an error, the contents of the div is replaced with an updated form with error messages. If the form has no errors in it, I want to reload the entire page from the ajax response, not just the div. Does anyone know how to do that? I have tried sending location header but it places the new page in the div. I have also tried javascript window.location but I don't know hot to get it executed when the ajax response has been received. I am not using jQuery so I want to do this in plan javascript and/or php. Thanks in advance!
I have a web page generated with php with a form placed within a div. The form is submitted using Ajax and validated on the server side. If there is an error, the contents of the div is replaced with an updated form with error messages. If the form has no errors in it, I want to reload the entire page from the ajax response, not just the div. Does anyone know how to do that? I have tried sending location header but it places the new page in the div. I have also tried javascript window.location but I don't know hot to get it executed when the ajax response has been received. I am not using jQuery so I want to do this in plan javascript and/or php. Thanks in advance!
Share Improve this question asked Aug 30, 2012 at 19:41 Thomas LennartssonThomas Lennartsson 411 silver badge2 bronze badges 1- 3 If you use Ajax, why do you want to reload the page? – Bergi Commented Aug 30, 2012 at 19:46
1 Answer
Reset to default 7Yes, you can do that in your callback as follows:
location.reload(true);
Honestly, that kind of defeats the purpose of doing something asynchronously.
本文标签: phpHow to reload the entire page from an ajax responseStack Overflow
版权声明:本文标题:php - How to reload the entire page from an ajax response? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745476107a2659971.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论