( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
$mysqli = new mysqli($DBHost, $DBUser, $DBPassword,$DBName);
$items_per_group = 10;
$results = $mysqli->query("SELECT COUNT(*) as t_records FROM gallery where isdisplay =3");
$total_records = $results->fetch_object();
$total_groups = ceil($total_records->t_records/$items_per_group);
$results->close();
?>
<script type="text/javascript">
$(document).ready(function() {
var track_load = 0; //total loaded record group(s)
var loading = false; //to prevents multipal ajax loads
var total_groups = <?php echo $total_groups; ?>; //total record group(s)
$('#results').load("autoload_process.php", {'group_no':track_load}, function() {track_load++;}); //load first group
$(window).scroll(function() { //detect page scroll
if($(window).scrollTop() + $(window).height() == $(document).height()) //user scrolled to bottom of the page?
{
if(track_load <= total_groups && loading==false) //there's more data to load
{
loading = true; //prevent further ajax loading
$('.animation_image').show(); //show loading image
//load data from the server using a HTTP POST request
$.post('autoload_process.php',{'group_no': track_load}, function(data){
$("#results").append(data); //append received data into the element
//hide loading image
$('.animation_image').hide(); //hide loading image once data is received
track_load++; //loaded group increment
loading = false;
}).fail(function(xhr, ajaxOptions, thrownError) { //any errors?
alert(thrownError); //alert with HTTP error
$('.animation_image').hide(); //hide loading image
loading = false;
});
}
}
});
});
</script>
<table id="Table_01" width="100%" height="537" border="0" cellpadding="0" cellspacing="0" style=" background-position:bottom; background-repeat:no-repeat; " >
<tr>
<td>
<table id="Table_01" width="100%" height="536" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="54">
<img src="images/best.png" width="326" height="54" alt=""></td>
</tr>
<tr>
<td width="800" align="center" height="482" valign="top">
<span id="results">
</span>
<div class="animation_image" style="display:none" align="center"><img src="ajax-loader.gif"></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td></tr></table>