Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do a javascript redirect and include post data

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?

like image 381
Mazatec Avatar asked Feb 26 '23 08:02

Mazatec


1 Answers

Create hidden form and submit it via javascript instead of window.location.replace('searchresults.php')

like image 146
simon Avatar answered Mar 05 '23 17:03

simon