问题:
从DB中过滤和搜索记录。
当你键入内容时,应该从db返回记录,但它将整个header.php
文件作为模板返回。可能是什么原因?这是我的jQuery和header.php
代码
的jQuery
$('#searchbox').on('keyup focus', function(e) {
var b = $(this).attr();
delete b.class, delete b.placeholder, delete b.id, delete b.name, delete b.type, delete b.autocomplete;
b.q = $(this).val();
f(b.q != '' && b.q.length > 0) {
$.ajax({
type: "POST",
url: api,
data: b,
cache: false,
success: function(b) {
$("#livesearch").html(b);
$("#livesearch").fadeIn();
}
});
} else {
$("#livesearch").fadeOut();
}
});
$('#searchbox').on('blur', function(e) {
$('#livesearch').fadeOut();
});