大家好,我有一个简单的问题,我想:
我在代码点火器中创建了一个博客,这就是我的代码的外观:
这是我的主页控制器:
public function index()
{
$data['posts'] = $this->Model_cats->getLivePosts(7);
$data['cats'] = $this->Model_cats->getTopCategories();
$data['title'] = 'Welcome';
$data['main'] = 'public_home';
$data['main2'] = 'public_home_loadpost';
$this->load->vars($data);
$this->load->view('template', $data);
}
我使用这个 jquery 来加载:
$(window).scroll(function())
{
if( $(window).scrollTop() == $(document).height() - $(window).height() ){
$('div#loadMoreComments').show();
$.ajax({
url: "WHAT PAGE PUTHERE.php?lastComment=" + $(".postedComment:last").attr("id"),
success: function(html){
if(html)
{
$("#postedComments").append(html);
$('div#loadMoreComments').hide();
}
else
{
$('div#loadMoreComments').replaceWith("Finished Loading the comments");
}
}
});
}
我真的不知道我可以在 jquery 文件中的 url 中放入哪个页面......该页面将为我获得更多帖子。请帮忙
我的观点看起来像这样
<?php
if ( count($posts) )
{
foreach ($posts as $key => $list)
{
echo "<div class='postedComment'>";
echo '<h2>'.$list['title'].'</h2>';
echo auto_typography( word_limiter($list['body'], 200) );
echo anchor('welcome/post/'.$list['id'],'read more >>');
echo "</div>";
}
echo '<br/><br/>';
}
?>
<div id='loadMoreComments' style="display:none;">hello</div>