jQuery, Ajax and PHP For Facebook like Autosuggestion

Sharing is caring!

Facebook like Autosuggestion user search with jQuery, Ajax and PHP. It’s simple and clean just you have to change the database details.

Download the Script. Edit Config.php change the database details.

Database

create database table with name “test_user_data”
CREATE TABLE test_user_data
(
uid INT AUTO_INCREMENT PRIMARY KEY,
fname VARCHAR(25),
lname VARCHAR(25),
country VARCHAR(25),
img VARCHAR(50)
);

Auto.html

contains jquery(javascript) and HTML Code. Take a look at input field class valuessearch
http://jquery.js
</script>
$(document).ready(function(){
$(“.search”).keyup(function()
{
var searchbox = $(this).val();
var dataString = ‘searchword=’+ searchbox;
if(searchbox==”)
{}
else
{
$.ajax({
type: “POST”,
url: “search.php”,
data: dataString,
cache: false,
success: function(html)
{
$(“#display”).html(html).show();
}
});
}return false;
});
});
</script>

<input type=”text” class=”search” id=”searchbox” />

Download Files

18 thoughts on “jQuery, Ajax and PHP For Facebook like Autosuggestion

Leave a Reply

Your email address will not be published. Required fields are marked *

Got Project on mind? Let's ConnectContact Us

Secured By miniOrange