Hi,
If i change the code as you mentioned, then the next set will get loaded before the page scoll reaches bottom of the page.
And the found the solution for this.
We have to round the window.scrollTop value to the next largest integer.
So the code should be like,
$(window).scroll(function() {
if (Math.ceil($(window).scrollTop()) == $(document).height() - $(window).height()) {
GetRecords();
}
});