标签:data var enc fir show cli app esc product
<div class="chanppin_content" id="listsBox"></div> <a id="moreClick">查看更多</a>
<script type="text/javascript"> var page = 1; var pageCount = 0; loadMore(); function loadMore(){ $.getJSON(‘{:U("loadMore")}‘,{p:page}, function(d){ pageCount = d.pageCount; $.each(d.lists, function(k, v){ $(‘#listsBox‘).append(‘<div class="chanppin_content_li wow zoomIn animated" data-wow-duration="1s" data-wow-delay=".2s"> <a href="‘+v.url+‘"> <div class="img"> <img src="‘+v.pic_text+‘" > </div> <div class="text"> <p>‘+v.title+‘</p> </div> </a> </div>‘); }); }); } $(‘#moreClick‘).click(function(){ if(page< pageCount){ page++; loadMore(); }else{ alert(‘没有了‘); } }); </script>
function loadMore(){ $where = ‘`id` >0‘; if(I(‘get.cid‘)){ $where .= ‘ and `cat_id` = ‘.I(‘get.cid‘); } $count = M(‘Xiangce‘)->where($where)->count(); $pageSize = 6; $pageCount = ceil($count/$pageSize); $page = new \Think\Page($count,$pageSize); $page->setConfig(‘theme‘, "%UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% <label class=‘f_14 clr_6‘>共%TOTAL_ROW%条</label>"); $this->page = $page->show(); $lists = M(‘Xiangce‘)->where($where)->order(‘order_id desc,id desc‘)->limit($page->firstRow.‘,‘.$page->listRows)->select(); foreach($lists as $k=>$v){ $lists[$k][‘url‘] = U(‘Product/view‘, [‘id‘=>$v[‘id‘]]); $lists[$k][‘pic_text‘] = __ROOT__.‘/Attached/‘.$v[‘pic‘]; } die(json_encode([‘lists‘=>$lists, ‘pageCount‘=>$pageCount])); }
标签:data var enc fir show cli app esc product
原文地址:https://www.cnblogs.com/ximishuier/p/11708081.html