Reputation: 1532
Let's say I have form looks like
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
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