Skip to content
Advertisement

how to hide results from database until the seacrh is complete in Laravel?

i am making a search for the website so the user can search for results from database

everything is working fine but how can i hide results until the user complete the search?

this is the controller:

JavaScript

and here is the view:

JavaScript

so my problem is the view is showing all the results before the user search and i want results to be hidden until the search is complete

how to achieve that?

Advertisement

Answer

it’s because in first load of the page search is null so you’re returning all of the database!

You can fix it like this:

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