Get search results then populate page without refresh

     

I am not realy sure where to start. I have a page setup to search for members in my admin panel. I am trying to find a way to get search results without refreshing the page when clicking a button. I already have a file that searches the db which is a seperate php file. The page the search box is on is also a php file. I have spent days googling and reading posts on here with little success. All i want is a button that when clicked will search the db for the member name in the search box then populate a list on the same page without refreshing the page. any tips would be much appreciated. this is my searchbox code below.


  
  
"
answer1
  
  

You should use ajax.


      
  1. Create your HTML form
  2.   
  3. Add a click event on your submit button
  4.   
  5. Call your backend endpoint from javascript
  6.   
  7. Display the response
  8.   

Here is an example from w3schools:


HTML: