//ปุ่มกด ครับ//
<a style="font-size: 20px;color: #42c7b7" href="javascript:void(1);" data-page='1' class="loadmore">Load More...</a>
//ปุ่มกด ครับ//
//javascript//
<script type="text/javascript">
$('.loadmore').click(function () {
var page = parseInt($('#page_now').text());
$.post('modules/ajax.php', {page: page}).done(function (data) {
var next_page = (page+1);
$('#box-upcoming').append(data);
$('#page_now').text(next_page);
});
});
</script>
//javascript//
// หน้าที่ต้องการให้แสดงครับ modules/ajax.php //
<?php
require_once 'db.php';
require_once 'function.php';
$max = '15';
$page_now = ($_POST['page']*$max)+15;
$eventss = $event->find(['approve' => 1, 'build' => 1] )->sort(['date_start' => 1])->skip($page_now)->limit($max);
foreach ($eventss as $ev => $varevent) {
$picture = $gallery->findOne([
'event_id' => $varevent['_id']->{'$id'}
], ['picture']);
$event_img = 'http://' . MEDIA_HOST . '/get/' . $picture['picture']['id'] . '/custom/170/150/';
$sniffer_var = $sniffer->find(['event_id' => $varevent['_id']->{'$id'}]);
?>
<div class=" col-md-4" style="background-color: white;margin-top: 1em;">
<div class="thumbnail">
<a style="text-decoration: none;" href="<?php echo'index.php?page=share&id=' . $varevent['_id']; ?>">
<article style="text-align: left; overflow:hidden">
<div class=" col-md-12 col-xs-7">
<img class="img-responsive" src="<?php echo $event_img ?>" title="<?php echo $varevent['name'] ?>" width="100%">
</div>
<p style="color: pink;"><?php echo date('d/m/Y', $varevent['date_start']->{'sec'}); ?></p>
<h5 style="height: 35px; max-height: 35px;font-weight: bolder;"><?php echo getSubStrTH($varevent['name'], 0, 27); ?></h5>
<div style="margin-top: 1em;">
<h5 style="height: 70px; max-height: 70px;"class="hidden-xs hidden-sm">
<?php echo getSubStrTH($varevent['detail'], 0, 50); ?>
</h5>
</div>
<div>
<p>Sniffing <?= count_check_var($sniffer_var); ?></p>
</div>
</article>
</a>
</div>
</div>
<?php
}
?>
// หน้าที่ต้องการให้แสดงครับ modules/ajax.php //