Server IP : 164.52.202.56 / Your IP : 216.73.216.231 Web Server : Apache System : Linux e2e-70-56.ssdcloudindia.net 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Tue Nov 5 04:50:16 EST 2024 x86_64 User : rubyaromatics ( 1052) PHP Version : 7.2.34 Directory (0750) : /home/rubyaromatics/public_html/ |
[ Home ] | [ Terminal ] | [ Upload File ] |
---|
<?php require('controller/function.php'); require('controller/database.php'); $ob = new database(); ?> <!DOCTYPE html> <html> <head> <link rel="stylesheet" id="font-awesome-style-css" href="https://www.phpflow.com/code/css/bootstrap3.min.css" type="text/css" media="all"> <!-- jQuery --> <script type="text/javascript" charset="utf8" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js"></script> <title>phpflow.com : Source code of simaple ajax pagination</title> </head> <body> <div><h3>Source code : PHP simaple ajax pagination</h1></div> <div> <div id="target-content" >loading...</div> <?php $limit = 10; $sql = "SELECT COUNT(id) FROM product"; $rs_result = mysql_query($sql); $row = mysql_fetch_row($rs_result); $total_records = $row[0]; $total_pages = ceil($total_records / $limit); ?> <div class="page text-center"> <ul class='pagination text-center' id="pagination"> <?php if(!empty($total_pages)):for($i=1; $i<=$total_pages; $i++): if($i == 1):?> <li class='active' id="<?php echo $i;?>"><a href='2.php?page=<?php echo $i;?>'><?php echo $i;?></a></li> <?php else:?> <li id="<?php echo $i;?>"><a href='2.php?page=<?php echo $i;?>'><?php echo $i;?></a></li></ul> <?php endif;?> <?php endfor;endif;?> </div> </div> <script> jQuery(document).ready(function() { jQuery("#target-content").load("2.php?page=1"); jQuery("#pagination li").live('click',function(e){ e.preventDefault(); jQuery("#target-content").html('loading...'); jQuery("#pagination li").removeClass('active'); jQuery(this).addClass('active'); var pageNum = this.id; jQuery("#target-content").load("2.php?page=" + pageNum); }); }); </script></body>