Coded pagination using ajax

I am using ajax pagination using codeigniter

<script>
$("div.review_pagination a").click(function(){
    var reviews_url=$(this).attr("href");
    alert(reviews_url);
    readmore_after5(); 
    $.post( reviews_url,{product_id:<?php echo $product->id;?> }
        ,function( data ){

     $('#review_pagination').html(data);   
    },"html");

    return false;
 });   

    });
</script>

here is my view page

<div class="span12" id="review_pagination">
        <!-- load the ajax call-->

        <?php echo $this->load->view('reviews_list');?>

          </div>

 $data['reviews']= $this->Product_model->get_reviews($id,$limit,$start);
 $data['total']= $this->Product_model->get_reviews_count($id,$term);

Below is the pagination, the pagination question is not only "2", if I go as 2,3,4,5,6 data, but the active pagination does not change from 1 to 2,3,4,5 , 6, therefore, based on data loading

$this->load->library('pagination');

  $config['base_url'] = base_url().'myaccount/ajax_reviews_data';
  $config['total_rows']     = $data['total'];
  $config['per_page']       = $rows;
  $config['uri_segment']        = 5;
  $config['first_link']     = 'First';
  $config['first_tag_open'] = '<li>';
  $config['first_tag_close']    = '</li>';
  $config['last_link']      = 'Last';
  $config['last_tag_open']  = '<li>';
  $config['last_tag_close'] = '</li>';
  $config['prev_link']                = '&lt;';
  $config['full_tag_open']  = '<div class="pagination review_pagination"><ul>';
  $config['full_tag_close'] = '</ul></div>';
  $config['cur_tag_open']       = '<li class="active"><a href="#">';
  $config['cur_tag_close']  = '</a></li>';
  $config['prev_link']                = '&lt;';
  $config['prev_tag_open']        = '<li>';
  $config['prev_tag_close']        = '</li>';
  $config['num_tag_open']       = '<li>';
  $config['num_tag_close']  = '</li>';
  $this->pagination->initialize($config);
  //$data['video_reviews']= $this->Product_model->get_video_reviews($id);
  if(isset($_GET['v'])&&$_GET['v']==1)
      $data['show_video_review']=1;
  else   
     $data['show_video_review']=0;

$this->template->write_view('content', 'product',$data, TRUE);
$this->template->render();
+3
source share
1 answer

I can’t say everything from the code that you sent, but remember that page links are the output of the pagination library, and your results are the result of your model (+ formatting in your html).

It seems to me that you are returning the results in your ajax answer, but not displaying a new page library.

, CI , , , , , , ,

0

All Articles