I have a bunch of selects as filters like this
<select name="color" data-options="katalog.php?cat=3" class="filter">
<option value="1">White</option>
<option value="2">Green</option>
</select>
$('body').on("change", '.filter', function() {
$('#mainstage').load($(this).data('options') + '&' + $(this).attr('name') + '=' + $(this).attr('value'));
})
The url you are requesting is "katalog.php?cat=3&color=undefined"
because you should not be using attr()
to read the value. Use jQuery's val()
method so you get the value of the option that was selected.
... '=' + $(this).val())