thinkphp使用js实现点击加载更多后, 底部无刷新加载出新的数据并显示在该页

thinkphp使用js实现点击加载更多后, 底部无刷新加载出新的数据并显示在该页

一.模板需要文件:

1、
2、
3、


4、

5、

说明:1和2是实现无刷新加载更多需要的js文件,3和4是显示数据模板中需要有的div便签,5是加载更多按钮,data-box=".index_list"定义加载出来的数据显示在哪里, class="js_more_list"用于响应加载更多js


二.模板需要文件:Common文件的p_list_more方法代码如下:

    /**
     * 加载更多
     */
    public function p_list_more(){
    	$p=intval($_GET['p']);
    	$id=intval($_GET['id']);
    	if(!$p) $p=1;
    	$start=$p*10;
    	
    	//**查询文章评论内容
    	$comments = D('Comment a')->field('a.*')
    	->where("a.newsid = $id and a.comment_show=1 and a.comment_delete=0")
    	->order('a.comment_time desc')
    	->limit($start, 10)
    	->select();
    	
    	$this->assign("p", $p+1);
    	$this->assign("id", $id);
    	$this->assign("comments", $comments);
    	$this->display();
    }


三.js文件下载

home_v2.js    
jquery.min.js     

http://pan.baidu.com/s/1nuyIcJJ


你可能感兴趣的:(thinkphp,html)