我正在寻找可以过滤结果的内容,因为用户输入的内容不仅仅是当用户点击字段时它现在的工作方式。我添加了实时和自动完成功能,但这并没有产生我想要的结果。
知道如何才能让它发挥作用吗?
$(document).ready(function(){
$("form#submit").live('change.autocomplete', function() {
// we want to store the values from the form input box, then send via ajax below
var thissearch = $('#thissearch').attr('value');
$.ajax({
type: "POST",
url: "includes/searchinventorytest.php?",
data: "thissearch="+ thissearch,
success: function(data){
$('div.success').fadeIn();
$('div.success').html(data);
}
});
return false;
});
});
答案 0 :(得分:1)
从facebook上得到我的答案,我想我会分享。我需要“on”和“keyup”
$("form#submit").on('keyup', function() {
// we want to store the values from the form input box, then send via ajax below
var thissearch = $('#thissearch').attr('value');
$.ajax({
type: "POST",
url: "includes/searchinventorytest.php?",
data: "thissearch="+ thissearch,
success: function(data){
$('div.success').fadeIn();
$('div.success').html(data);
}
});
return false;
});
});