زمانی که بر روی دکمه نمایش اطلاعات کلیک می کنم اطلاعات به صورت ajax نمایش داده می شوند اما زمانی که بر روی شماره های صفه بندی کلیک می کنم صفحه رفرش می شود و هیچ اتفاقی رخ نمی دهد.
444.png
این کدهای فایل test.php :
<html>
<head>
<title>Bingo</title>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"> </script>
<script type="text/javascript" src="js/jquery-1.11.1.min.js"> </script>
<script type="text/javascript" src="js/jquery.min.js"> </script>
<script type="text/javascript">
$(document).ready(function() {
$("#display").click(function() {
$.ajax({ //create an ajax request to load_page.php
type: "GET",
url: "p_test.php",
dataType: "html", //expect html to be returned
success: function(response){
$("#responsecontainer").html(response);
//alert(response);
}
});
});
});
</script>
</head>
<body>
<h3 align="center">Manage Student Details</h3>
<table border="1" align="center">
<tr>
<td> <input type="button" id="display" value="Display All Data" /> </td>
</tr>
</table>
<div id="responsecontainer" align="center">
</div>
</body>
</html>
و این هم کدهای فایل پردازش (p_test.php) :
<?php
mysql_connect('localhost','root','');
mysql_select_db('school');
?>
<html>
<head>
<script type="text/javascript" src="js/jquery-1.3.2.min.js"> </script>
<script type="text/javascript" src="js/jquery-1.11.1.min.js"> </script>
<script type="text/javascript" src="js/jquery.min.js"> </script>
</head>
<body>
<?php
//$page=isset($_GET['page'])?$_GET['page']:1;
$page=isset($_GET['page']) ? max(1,intval($_GET['page'])) : 1;
if($page=="" || $page=="1")
{
$page1=0;
}
else
{
$page1=($page*5)-5;
}
echo '
<table class="table" style="font-size:12px; text-align:center">
<tr>
<th>ردیف</th>
<th>نام دسته</th>
<th>کلاس</th>
</tr>
';
mysql_query('set names "utf8"');
$res=mysql_query("select * from categorie limit $page1,5");
while($row=mysql_fetch_array($res)){
echo "<tr>";
echo "<td>".$row['c_id']."</td>";
echo "<td>".$row['c_name']."</td>";
echo "<td>".$row['c_class']."</td>";
echo "</tr>";
}
echo '</table>';
//this is for counting number of page
mysql_query('set names "utf8"');
$res1=mysql_query("select * from categorie");
$cou=mysql_num_rows($res1);
$a=$cou/5;
$a=ceil($a);
echo "<br />";
for($b=1;$b<=$a;$b++)
{
?><a href="p_test.php".php?page=<?php echo $b; ?>" style="text-decoration:none"><?php echo $b." "; ?></a><?php
}
?>
<?php
?>
</body>
</html>
تشکر.
عکس های ضمیمه
444.png
(14.0 کیلوبایت)