In this tutorial we are going to build AJAX search box using PHP. Now a days every website has integrated this kind of search feature. This search box populate the results in real time from MySQL database based on entered text in search box.
This Search box of HTML is completely controlled by JQuery function. On key-up event of input field (e.g. Search Box), This JQuery function send the request to "controller.php" page via. AJAX technique. This request find the best match from MySQL database and display the result in "search.php" page.
First Create "Post" Database Table
Once You have created above table, Then put the records in this table.
config.php
Consists of database configuration details to establish database connection.
controller.php
Controller work is to control the flow of execution. Here on Key-Up, JQuery script send request to "controller.php" page and it will process the request and return response to be displayed.
This Search box of HTML is completely controlled by JQuery function. On key-up event of input field (e.g. Search Box), This JQuery function send the request to "controller.php" page via. AJAX technique. This request find the best match from MySQL database and display the result in "search.php" page.
Simple Ajax Search Example
First Create "Post" Database Table
Once You have created above table, Then put the records in this table.
config.php
Consists of database configuration details to establish database connection.
controller.php
Controller work is to control the flow of execution. Here on Key-Up, JQuery script send request to "controller.php" page and it will process the request and return response to be displayed.
ajax search
Reviewed by Sumit Kumar Pradhan
on
April 09, 2019
Rating:
No comments: