i use the “ajax load more” described as here: https://getkirby.com/docs/cookbook/ajax-load-more
and it works. Now i want to build a filter function and use PHP for it. This works, but I only get the first 4 results in the right sorted order. If I click ‘load more’ the JSON gives me the old results, which are not in the sorted order I filtered. Do I have to update the JSON somehow? Thx for ur help !
Then in your JS, get the value and pass it on in your get request (example from the tuturial, modify as needed):
$(function(){
var element = $('.projects');
var url = element.data('page') + '.json';
var limit = parseInt(element.data('limit'));
var offset = limit;
// get the value from data-name attribute
var name = element.data('name');
$('.load-more').on('click', function(e) {
// send the value with your Ajax request
$.get(url, {limit: limit, offset: offset, firstname: firstname}, function(data) {
if(data.more === false) {
$('.load-more').hide();
}
element.children().last().after(data.html);
offset += limit;
});
});
});