这里做异步加载只是一个简单的用JS来处理异步加载和展示出来的数据,做一个简单的记录:
<script type="text/javascript"> (function(){ var chanpinListUrl = __ROOT__+"?a=Index&c=Index&m=ajaxchanpinlist"; var info = oStr = oSum = ""; $(window).scroll(function(){ if($(document).scrollTop()+$(window).height()>=$(document).height()){ oSum = $(‘div.chanpinListBox>a‘).size(); $.post(chanpinListUrl,{sum:oSum},function(result){ eval("info="+result); oStr = ""; for(var key in info){ oStr += "<a href=‘"+"./"+"?a=Index&c=Index&m=content&mid=25&cid="+info[key][‘cid‘]+"&aid="+info[key][‘aid‘]+"‘ class=‘pr‘><h3 class=‘f100‘>"+info[key][‘title‘]+"</h3><p class=‘desc‘>"+info[key][‘duanmiaoshu‘]+"</p><span class=‘b ttu‘>more>></span><img src=‘"+info[key][‘thumb‘]+"‘ class=‘parb‘></a>"; }; $(‘div.chanpinListBox‘).append(oStr); }); }; }); })(); </script>
时间: 2024-10-07 20:31:35