haha
haha

Reputation: 1532

Which query is good to display results on search

Let's say I have form looks like

alt text

First: Use jQuery to display data like auto submit on every select field

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

Second : One time query. Select all fields then click search button

I want to know which method is good to display the search results.

Upvotes: 1

Views: 92

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038740

How about using an AJAX submit. This way you could refresh only the results part of the page and make your site more dynamic:

$('#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
        } 
    });
});

Upvotes: 2

Related Questions