如果我们在jquery中获得ajax调用的结果,则过滤结果

时间:2015-03-09 06:13:49

标签: javascript php mysql ajax

我正在为物业搜索网站创建一个自动搜索框。 我的问题是,每次按下一个单词,它都会向我的搜索文件发送一个请求。 我需要一些东西,如果我们第一次得到结果,每当我按下一个键就会匹配之前的结果,如果它不存在于数据中它发送请求,则根据新关键字过滤先前的数据。

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;      
});

0 个答案:

没有答案
相关问题