This post is about Facebook style data loading while scrolling down the page. To identify the page scroll down, you can use the following snippet.
This condition will satisfy when user scroll down and reached the bottom of the page. This will invoke the Ajax get method, which will return JSON data from server. For rendering the JSON, I am using jsrender template-ing engine. Here is the complete implementation. I am not using any database for this sample.
Here is the server side (MVC controller)
Client side (JQuery and JSRender)
And here is the HTML part.
And here is the JSRender template
For identifying the Page, I am using the Div Id. If you don’t want that approach you can create a hidden variable and can do the same.
Happy Coding :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.
Did you like this article? Share it with your friends