Reputation: 11649
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?
Upvotes: 4
Views: 6344
Reputation: 2049
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.
Upvotes: 0
Reputation: 1191
Create hidden form and submit it via javascript instead of window.location.replace('searchresults.php')
Upvotes: 8