I am making a load more paginate button, I’m stuck at two things that are both similar. I don’t have a way of increasing pages, and I don’t have a way for the script to know when the paginate is finished. Here is my jQuery code for the load more:
$(document).on('click', '#loadmore', function() {
$.get('/artistprofileloadmore.php?page=2&aid=$aid', function(data) {
$("#append").append(data);
});
});
I can easily solve this if there is a way for the jQuery to receive a variable value from the php file. So is there? Simply put, if the paginate is finished, the variable $end=1 is set, otherwise it is set to 0, is there a way I can use the jQuery to check when the variable $end==1 and then I would remove the div #loadmore to remove the next page button.
For the next page, is there a way that I can set jQuery to increase a variable every time it is run, which will increase the page number? The variable would be used instead of this two:
?page=2
and increase every click
From PHP return a JSON like this
{"artists"="The Artists profiles","isLast"=true}