Skip to content
Advertisement

Search result from other pages

I created a table that displays the values ​​from the my mysql table. Then, using the tutorial, I created pagination system.

Top of page:

JavaScript

Bottom of page:

JavaScript

Then I created a search engine (input) with onkeyup="myFunction()" and MyFunction looks:

JavaScript

My problem appears when I try to search for something – it searches only from 1 page, and from other pages it does not download results. I would like to make it search me from all pages.

Advertisement

Answer

You need to implement searching on back-end instead of front-end because you are loading only one page instead of all results.

Let’s say that your current link looks like http://localhost:8080/table?page=1, you need to modify it so it sends value of the search input to the back-end ex. http://localhost:8080/table?page=1&s=somevalue.

Then you need to pass that value to the SQL script and based on the result do the pagination.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement