jquery.more.js操作原理:点击加载更多时候,触发事件,发送ajax请求到php ,php 将数据发送回ajax 回调函数里面,然后用js 追加到你页面的后面就可以了
jquery.more.js使用方法:
引入文件<script></script> <br>
<script></script>
调用加载更多数据插件:jquery.more.js$(function(){ <br>
$('#more').more({'address': 'data.php'}) <br>
});
PHP处理require_once('connect.php'); <br>
<br>
$last = $_POST['last']; <br>
$amount = $_POST['amount']; <br>
<br>
$query = mysql_query("select * from article order by id desc limit $last,$amount"); <br>
while ($row = mysql_fetch_array($query)) { <br>
$sayList[] = array( <br>
'title' => "<a>".$row['title']."</a>", <br>
'author' => $row['id'], <br>
'date' => date('m-d H:i', $row['addtime']) <br>
); <br>
} <br>
echo json_encode($sayList);
jquery.more.js中文API和加载更多演示:http://www.sucaihuo.com/js/380.html
PHP+Ajax点击加载更多内容.zip ( 10.06 KB 下载:192 次 )
AD:真正免费,域名+虚机+企业邮箱=0元