Load Data while Scrolling Page Down with jQuery and PHP
<script type="text/javascript">
var page = 1;
function getFeedItems() {
$('.loading').show();
$.ajax({
url : 'loadmore.php',
data : 'page=' + page,
type : 'GET',
success: function(a) {
if (a == '') {
$('#feed-list').append('<li>No more records found.</li>');
$(window).scroll(function() {});
$('.loading').hide();
} else {
$('#feed-list').append(a);
$('.loading').hide();
}
}
});
}
$(document).ready(function() {
getFeedItems();
$(window).scroll(function()
{
if($(window).scrollTop() == $(document).height() - $(window).height())
{
page = page+1;
getFeedItems();
}
});
});
</script>
<ul class="list" id="feed-list">
</ul>
create loadmore.php
and $_GET['page'];
-------------------------------------------------------------
if you helpful my code please donate some few amount to
developing and free to post.
-------------------------------------------------------------
Comments
Post a Comment