I used this code for post filtering by post category. Categories are listed in a ul
list. I want to pass that li
value to my function. In this code only the first item value is passed.
$(document).on("click", "#cats", function() {
var selval = $("#cats").data('slug');
$.ajax({
url: "<?php bloginfo('template_url'); ?>/ajaxfiles/ajax-blog-cata.php",
type: "POST",
cache: 'false',
data: {
selval: selval
},
success: function(data) {
console.log(data);
$('#blog-cata').empty()
$('#blog-cata').html(data);
}
});
});