In this Ajax Crud system development part we have start discussing on Live Data Search by using Ajax Jquery method in Object Oriented PHP programming script. We can make a simple but very userful live Mysql Database Table data searching element by using the Ajax with PHP OOP, in which the search or filter data results will load on web page in html table format as we have starting type search query in search input textbox.
By using this type of feature we can search or filter large amount of data without page refresh because in this we have use Ajax request for search or filter data at server side in PHP OOP Script. In any web application searching is very important or most required functionality and if We have provide live searching of Mysql data then that will provide us fast search or filter data result on web page without page refresh.
This tutorial is one part of Ajax Crud System make by using Object Oriented PHP Script. In previous part we have already seen how to remove or delete data by using Ajax with PHP OOP Script. But here we have seen some new Advance topic like Live Data search by using Ajax with PHP Script.
For this on index.php page which we have already make, so on this page we have define one textbox, so we can type search query in this input field. In this textbox we have define "id=search". We will use attribute as a selector in jquery code.
After this we have write jquery code on search textbox keyup jquery event, in this jquery code we have use textbox "id=search" as selector, so when any one in search query in textbox then this code will execute and this code has send ajax request to "action.php" page, during sending ajax request, it has been send textbox value in query variable and one action variable data to "action.php" page. In Ajax Success callback function receiving filter data in table format from server and that data has been display on this "
This code we have write on "action.php" page and this code first check value of $_POST["action"] variable is equal to Search, this variable we have pass though ajax request to this page. If value equal to "Search" then it will execute if block of code and under this block first it will clean value of $_POST["action"] variable which is also we have pass using Ajax method. After clean value it will make on select query for search data by using LIKE Mysql operator. After making Search query we want to execute this so we have use $object->get_data_in_table($query) function, this function we have already make in Crud class in previous part. This function will execute query and return query result into html table format and that result we have send to Ajax request and it will display result on web page.
So, this is simple live mysql table data search system make by using Ajax Jquery method and Object Oriented Programming. If you have any query regarding this tutorial, please comment your query under comment box