THINKPHP5点击加载更多,流加载并实现实时评论
- html
<div style="text-align:center;margin-top:16px;" >
<a class="loadmore" id="loadmore">加载更多>>></a>
</div>
``
2. js
function getLocalTime(nS) {
return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,’ ');
}
//加载更多
var nStart =0;
var html='';
// <div>'+item.createtime+'</div>\
// $('#loadmore').click(function() {
$("body").on( "click", "#loadmore", function() {
// var content =$("#content").html();
var _this = $("#xinhao");
if(nStart >= {$count}) {
//alert('后面没有数据了!');
$("#loadmore").html('没有数据了亲...').css({"color":"666","height":"30px","line-height":"30px"});
} else {
//alert('还有数据!');
$.post("{:url('index/data')}", {start:nStart}, function(res) {
$.each(res.result, function(i, item) {
_this.append('<div class="content">\
<div class="title">\
<div><img style="height:50px;width:50px;" src="/static/hui