I'm currently working on a site and I would like to barrow the technique from Facebook on how the 'pagination' or 'view more' works. I think I have it sorted out but I'm just asking if开发者_JAVA百科 this is the prefered approach or if I'm way off base.
- I'd have a More button that when the user hovered or clicked upon it I'd fire off an ajax request.
- The ajax request would pass two variables the limit and the current item (just like a normal pagination would work) and grab the results from the database and render them as necessary for the feed/etc.
- I'd use jQuery's append to add an anchor link here so i could jump to the spot where the last post was. Then I'd append the results from the ajax request to the bottom of my feed/etc.
- Fire the link to move the screen to the anchor tag and call it a day.
Anything I'm missing? Any flaws that you see that you could give me a heads up on... I'm currently using primarily PHP, MySQL, and jQuery as my weapons of attack.
Any assistance would be appreciated.
I have implemented this with similar idea.
When you click the "more" button,
remove that button.
Request with $.getJSON a page to get next page data.
append those to the content-page-div.
append the removed "more" button to the end.
精彩评论