<script>
$(document).ready(function(){
var inProgress=false;
var startFrom=10;
$(window).scroll(function(){
if($(window).scrollTop() + $(window).height() >= $(document).height() && !inProgress ){
$.ajax({
url:'ajaxlogs.php',
method:'POST',
data:{"startFrom":startFrom},
beforeSend:function(){inProgress=true;
}
}).done(function(data){
data=jQuery.parseJSON(data);
if(data.length>0){
$.each(data, function(index, data){
$(".my_cont").append('<p class="ogl">' + data.title + '</p><div class="box">' + data.text + '</div>');
});
inProgress=false;
startFrom +=10;
}
});
}
});
});
</script>
<script>
$(document).ready(function(){
var inProgress=false;
var startFrom=10;
var div = $('.my_cont'),
div_sh = $(div)[0].scrollHeight,
div_h = div.height();
$(div).scroll(function(){
if ($(this).scrollTop() >= div_sh - div_h && !inProgress ){
$.ajax({
url:'ajaxlogs.php',
method:'POST',
data:{"startFrom":startFrom},
beforeSend:function(){inProgress=true;
}
}).done(function(data){
data=jQuery.parseJSON(data);
if(data.length>0){
$.each(data, function(index, data){
$(".my_cont").append('<p class="ogl">' + data.title + '</p><div class="box">' + data.text + '</div>');
});
inProgress=false;
startFrom +=10;
}
});
}
});
});
</script>