If mysql code is in index.php file, it working fine, but it cant be refreshed I have tried to move it to another file and then load it with JQuery function .load(),
$("#pagesn").load("data.php");
now it can be refrehed, but links not working anymore any Ideas?
Mysql code:
<?php
require_once 'libs/db.class.php';
require_once 'libs/global.inc.php';
$sql1="select * from zinutes LIMIT 3";
$result1=$db->select($sql1);
$query="select count(*) as tot from zinutes";
$countset=$db->runquery($query);
$count=$db->get_row($countset);
$tot=$count['tot'];
$page=1;
$ipp=3;//items per page
$totalpages=ceil($tot/$ipp);
echo"<ul class='pages'>";
for($i=1;$i<=$totalpages; $i++)
{
echo"<li class='$i'>$i</li>";
}
echo"</ul>";
?>
JS code for clicking the links:
$(document).ready(function(){
function showLoader1(){
$('.search-background1').fadeIn(200);
}
function hideLoader1(){
$('.search-background1').fadeOut(200);
alert("yra");
}
$("#pagesn").on("click",".pages li",function(){
showLoader1();
$("#pagesn .pages li").css({'background-color' : ''});
$(this).css({'background-color' : '#A5CDFA'});
$("#resn").load("data1.php?page=" + $(this).attr("class"), hideLoader1);
});
});
Tried to include that php file to specific div and then refresh it with JS, got same, not working result.