我在 home.php 中构建了两个函数来在我的提要中加载 +10 个帖子。它加载了两个新帖子,但有一个缺陷。它复制了它所包含的整个 home.php。即标题、提要、状态保持器和加载更多选项卡。我不知道为什么。我怎样才能阻止这种情况发生。也许将流放在自己的页面中并自行调用它?
<script>
var global_streamcount=20;
function refreshstream()
{
$.ajax({
method: 'get',
url : 'home.php?limit='+global_streamcount,
dataType : 'text',
success: function (text) { $('#homestatusid').prepend(text); }
});
}
</script>
<script>
function checkautoload(){
global_streamcount=global_streamcount+10;loadstream('home.php','homestatusid',global_streamcount);
}
</script>
加载更多
<div class="stream_show_posts" onClick="global_streamcount=global_streamcount+10;refreshstream();">Show More Posts</div>
PHP
if(isset($_GET['limit'])){
$sqllimit = $_GET['limit'];
}else{
$sqllimit = 20;
}
$call="SELECT * FROM streamdata WHERE streamitem_target= $following_string OR streamitem_creator = $following_string OR streamitem_creator IN $friendlist AND streamitem_target IN $friendlist ORDER BY streamitem_timestamp DESC LIMIT $sqllimit";