I've build an application (with PHP, Codeigniter and jQuery) that uses ajax for pagination, similar to how Twitter made it back in the day (clicking a button to load in more data).
It's all quite well, but there are a few issues however.
When there are no more posts left to load in, I want the "load-more"-button to be removed. However, right now I can only check if there are any posts left when I click the button, and the script returns null.
This is how it is now: Let's say that there are 14 posts in the database. 5 is loaded per default.
1 - click load-more, 5 more posts are loaded. 4 remain.
2 - click load-more, the remaining 4 posts are loaded.
3 - click load-more, no more remaining posts, button disappears
But I want to get rid of step 3, the application should "be aware" of that there are no more posts left to render at step 2.
I am sure there are a simple way that I haven't thought if yet...