kodlarım aşağıdadır.
index.php dosyası:
<script></script>
<script>
$(document).ready(function(){
var url = "islem.php";
$("#search-box").keyup(function(){
$.ajax({
type: "POST",
url: url,
data:'keyword='+$(this).val(),
beforeSend: function(){
$("#search-box").css("background","#FFF url(LoaderIcon.gif) no-repeat 165px");
},
success: function(data){
$("#suggesstion-box").show();
$("#suggesstion-box").html(data);
$("#search-box").css("background","#FFF");
}
});
});
});
function selectCountry(val) {
$("#search-box").val(val);
$("#suggesstion-box").hide();
}
</script>
islem.php dosyası:
if(!empty($_POST["keyword"])) {
$query =mysql_query("SELECT * FROM country WHERE name like '" . $_POST["keyword"] . "%' ORDER BY name LIMIT 0,6");
$result = mysql_num_rows($query);
if($result > 0) {
?>
while($country=mysql_fetch_array($query))
{
?>
- ');">