I am trying to add infinite scrolling to codeigniter's pagination with the Infinite scroll jquery plugin. But with no success
Here is my controller:
$config['base_url'] = site_url('news/home/');
$config['total_rows'] = $this->home_model->count_new();
$config['per_page'] = 3;
$config['uri_segment'] = 3;
$config['limit'] = $config['per_page'];
$this->pagination->initialize($config);
$data['news'] = $this->home_model->list_data_new($config['per_page'], $this->uri->segment($config['uri_segment']));
$this->load->view('news_view',$data);
Here is my view :
<div id="content">
<?php foreach ($news as $data):?>
<?php echo $data['title']?>
Post by: <?php echo $data['username']?>
<?php endforeach;?>
</div>
<button id="next">load more</button>
And here is the javascript also in view:
$('#content').infinitescroll({
navSelector : "#next:last",
// selector for the paged navigation (it will be hidden)
nextSelector : "#next:last",
// selector for the NEXT link (to page 2)
itemSelector : "#content"
// selector for all items you'll retrieve
});
The pagination link will look like this http://localhost/latihan/news/home/3
then click next will be like this http://localhost/latihan/news/home/6
The problem is the next post doesn't showing up and load more button is not loading data.
Any answer?
Many thanks...