Reputation: 85
I have a search bar in my page. If I search something, My resultdiv shows me result. But when I move to next page and come back on clicking back button the resultdiv don't show my results. I want the resultdiv to be preserved. I use keyup event on my search bar.
Upvotes: 0
Views: 589
Reputation: 519
If you apply your search in the url bar with a question mark (known as $_GET
in PHP) you can use the JavaScript method window.history.go( -1 )
and this goes back to the same path before which includes the $_GET
variable.
URL bar:
my_page.php?search=something
Upvotes: 1