嘿伙计,我只是给你一个想法:
考虑您有表链接和列名以及其中有链接的链接。
首先在你的html中直接使用php。
索引.HTML
<html>
<head>
<script type="text/javascript" src="jquery.js">
<script type="text/javascript">
$(document).ready( function() {
$("#more").click( function() {
var get = document.getElementsByClassName('num');
var numberofget = "limitnext="+get.length;
$.ajax({
type : "POST",
url : "more_results.php",
data : numberofget,
cache : false,
success : function(html){
$(this).remove();
$("#results").append(html);
}
});
});
});
</head>
<body>
<div id="results">
<?php
include("db.php");
$query1 = "SELECT * FROM Links LIMIT 0 , 20";
$query2 = "SELECT * FROM Links";
$result1 = mysql_query($query1);
$result2 = mysql_query($query2);
$count = mysql_num_rows($result2);
while($rows=mysql_fetch_array($result1)){
$links=$rows['links'];
echo "<div class='num'>".$links."</div>";
}
if($count>=20){
echo "<a id='more' href='#'>More Results of Links</a>";
}
?>
</div>
</body>
</html>
more_results.php
<?php
include "db.php";
$limit=$_POST['limitnext'];
$limitaddup=$_POST['limitnext']+20;
$query1 = "SELECT * FROM Links LIMIT ".$limit." , ".$limitaddup.";
$query2 = "SELECT * FROM Links";
$result1 = mysql_query($query1);
$result2 = mysql_query($query2);
$count = mysql_num_rows($result2);
while($rows=mysql_fetch_array($result1)){
$links=$rows['links'];
echo "<div class='num'>".$links."</div>";
}
if($count>=$limitaddup){
echo "<a id='more' href='#'>More Results of Links</a>";
}
?>