I am creating a auto search box for property search website. My problem is that every time i press a word it sends a request to my search file. I need something that if once we have results first time and after whenever I press a key it match previous results and if it is not present in data it send request else filter previous data according to new keyword.
if(searchid!='')
{
$.ajax({
type: "POST",
url: "search.php",
data: dataString,
cache: true,
success: function(html)
{
//alert(html);
jQuery("#result").fadeIn(0);
$("#result").html(html).show(0);
}
});
}
else if(searchid=='' || searchid.length<3)
{
$("#result").html('').hide();
}
return false;
});