admin管理员组文章数量:1356250
I am designing an web application. This application has a number of users.
All users can see and use a search form - however only those who are logged in can submit the form properly.
So when the form is submitted - BEFORE redirecting to the results page and showing the results, a jquery ajax function fires, checks if the user is logged in and if the user is logged in does a
window.location.replace('searchresults.php')
to the search results page.
How can I ensure that the correct POST data (from the form input fields) is included in the redirect?
I am designing an web application. This application has a number of users.
All users can see and use a search form - however only those who are logged in can submit the form properly.
So when the form is submitted - BEFORE redirecting to the results page and showing the results, a jquery ajax function fires, checks if the user is logged in and if the user is logged in does a
window.location.replace('searchresults.php')
to the search results page.
How can I ensure that the correct POST data (from the form input fields) is included in the redirect?
Share Improve this question asked Jan 20, 2011 at 15:44 MazatecMazatec 11.6k23 gold badges74 silver badges108 bronze badges2 Answers
Reset to default 8Create hidden form and submit it via javascript instead of window.location.replace('searchresults.php')
You cannot do a window.location redirect and supply POST data. The HTTP spec just does not support the redirect header with any POST data.
I think your searchresults.php page should always load - but if they are not logged in, don't perform the search. Far simpler.
本文标签: phpHow to do a javascript redirect and include post dataStack Overflow
版权声明:本文标题:php - How to do a javascript redirect and include post data - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743976304a2570891.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论