哪个查询可以在搜索上显示结果

时间:2010-12-26 09:27:43

标签: php jquery

假设我的表格看起来像

alt text

首先:使用jQuery在每个选择字段上显示自动提交等数据

$('#region,#categories,#types').change(function () {
    $(this).closest("form").submit();
});

第二:一次性查询。选择所有字段,然后单击搜索按钮

我想知道哪种方法可以显示搜索结果。

1 个答案:

答案 0 :(得分:2)

如何使用AJAX提交。这样,您只需刷新页面的结果部分,并使您的网站更具动态性:

$('#region,#categories,#types').change(function () {
    var form = $(this).closest("form");
    $.ajax({
        url: form.attr('action'),
        type: form.attr('method'),
        data: form.serialize(),
        success: function(result) {
            // TODO: show the results
        } 
    });
});