I'm trying to refresh my div using an ajax call, but for some reason it only fires in the first click, what am i doing wrong.
the first time i click the button it do everything fine, after that nothing happens (the loading part the rest of the script works fine)
here is the code of my javascript:
$('.btn-filtrar').on('click', function(){
let id = $(this).closest('tr').data('id');
let filter_type = $(this).closest('tr').data('type');
let sort_order = document.getElementById(filter_type +'_sort-order_' + id).value;
//console.log(id, filter_type, sort_order);
$.ajax({
url: "index.php?route=module/eot_filter/saveFilter&token=<?php echo $token; ?>",
type: "POST",
data: {
id:id,
filter_type:filter_type,
sort_order:sort_order
},
success: function (result) {
$("#"+ filter_type +"").load(" #"+ filter_type +"");
}
});
});