AJAX form show results in other page
-
I have a plugin that insert a form to make an AJAX POST request through an API and show result in same page without changing URL. What I need is to use this form in two pages (home and other page call explore) and add the possibility to make request using the URL.
When user is in home page use this form to redirect to website.com/explore/parameter1/parameter2/… and show the query. When user is in website.com/explore show the page without any result and search form at top.
I have been searching a lot trying to find an answer to what is the best method to use but I could not find anything clear. Some method to use can be (maybe they are absurd):
– In home use normal PHP GET request (by default plugin use POST, I am not sure why, maybe because it request an access token to access to the API) and redirect to explore page with parameters in URL. In explore use the same form fields but using AJAX to make the request in order to not refresh the page and update URL through Javascript.
– Use the same AJAX form in both pages to update the URL, take parameters from this new URL and make the query using them. After, create a rule to redirect all the pages with the format webiste.com/explore/* to a specific page without modifying the URL (if it is possible).
Right now, I am a bit lost and any help will be welcome because the more I study, the more I get lost. It seems that after this, it will come the cache problem….
- The topic ‘AJAX form show results in other page’ is closed to new replies.