Hide load more button if no more post in selected category

I believe you should pass one more label “How many posts remain to be seen” in your $response array in function filterPosts()

You know the total number of posts based WP_Query that exist in the database

$filter_query = new WP_Query($filter_args);
$total_query_posts = $filter_query->found_posts;

So, then you have to calculate it based on paged and posts_per_page, pass the remain number posts in the other variable and then make an if condition in your js to hide the button

This is a quick thought

techhipbettruvabetnorabahisbahis forumuedueduseduseduedueduedusedusedusedu