January 08, 2014 by Anuraj Estimated read time : 3 mins
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.