.category-filter
form#ajax-filter(style="margin-bottom: 1em;")
select
option(disabled selected) Выбор категории
option(value="1") Один
option(value="2") Два
option(value="3") Три
option(value="4") Четыре
#post-container
|Вывод результата AJAX
p Результат теста:
strong#test
View Compiled
$('.category-filter select').on('input', function(e) {
e.preventDefault();
var cat_id = $(this).val();
$("#test").text(cat_id);
/*
$.ajax({
url: myAjax.url,
type: 'POST',
data: {
action: 'filter_posts_by_category',
cat_id: cat_id,
nonce: myAjax.nonce
},
success: function(response) {
$('#post-container').html(response);
},
error: function(error) {
console.log(error);
}
});
*/
return !1;
});
This Pen doesn't use any external CSS resources.