IrishDave
New Coder
Hi everyone, hope your all couping with lock down.
I have a question regarding pagination and hoping for some advice.
I have created a members profile page on my website (development site) which allows users to add a post on their profile.
I added some pagination with a load more button. The page loads 3 posts then the user can add more if they hit the load more
button. This is done by using an Ajax call to a php script that returns 3 post at a time.
Each member post has a function to delete their own post.
I do this by using a Javascript Ajax call to a php script that deletes the post.
Then I simply use JQuery to remove that post from the DOM so it is no longer visible to the user.
Now for the problem, removing the post from the DOM breaks my pagination.
When the user removes their post I would like another post to simply take that posts place.
Because I have 3 posts per page when 1 is remove 2 posts are left. The page does not update
with other posts that exist. I probably have confused everyone now.
Im sort of looking for some advice on how to approach this problem.
Thanks a lot,
IrishDave
I have a question regarding pagination and hoping for some advice.
I have created a members profile page on my website (development site) which allows users to add a post on their profile.
I added some pagination with a load more button. The page loads 3 posts then the user can add more if they hit the load more
button. This is done by using an Ajax call to a php script that returns 3 post at a time.
Each member post has a function to delete their own post.
I do this by using a Javascript Ajax call to a php script that deletes the post.
Then I simply use JQuery to remove that post from the DOM so it is no longer visible to the user.
Now for the problem, removing the post from the DOM breaks my pagination.
When the user removes their post I would like another post to simply take that posts place.
Because I have 3 posts per page when 1 is remove 2 posts are left. The page does not update
with other posts that exist. I probably have confused everyone now.
Im sort of looking for some advice on how to approach this problem.
Thanks a lot,
IrishDave