title: Codeigniter pagination using ajax
body: <p>I am using ajax pagination using codeigniter</p>
  
  <pre><code>&lt;script&gt;
  $("div.review_pagination a").click(function(){
      var reviews_url=$(this).attr("href");
      alert(reviews_url);
      readmore_after5(); 
      $.post( reviews_url,{product_id:&lt;?php echo $product-&gt;id;?&gt; }
          ,function( data ){
  
       $('#review_pagination').html(data);   
      },"html");
  
      return false;
   });   
  
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>here my view page</p>
  
  <pre><code>&lt;div class="span12" id="review_pagination"&gt;
          &lt;!-- load the ajax call--&gt;
  
          &lt;?php echo $this-&gt;load-&gt;view('reviews_list');?&gt;
  
            &lt;/div&gt;
  
   $data['reviews']= $this-&gt;Product_model-&gt;get_reviews($id,$limit,$start);
   $data['total']= $this-&gt;Product_model-&gt;get_reviews_count($id,$term);
  </code></pre>
  
  <p>Below is the pagination,issue with the pagination not only '2', if i go like 2,3,4,5,6 data is coming but pagination active is not changing from 1 to 2,3,4,5,6 so based on the data loading</p>
  
  <pre><code>$this-&gt;load-&gt;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'] = '&lt;li&gt;';
    $config['first_tag_close']    = '&lt;/li&gt;';
    $config['last_link']      = 'Last';
    $config['last_tag_open']  = '&lt;li&gt;';
    $config['last_tag_close'] = '&lt;/li&gt;';
    $config['prev_link']                = '&amp;lt;';
    $config['full_tag_open']  = '&lt;div class="pagination review_pagination"&gt;&lt;ul&gt;';
    $config['full_tag_close'] = '&lt;/ul&gt;&lt;/div&gt;';
    $config['cur_tag_open']       = '&lt;li class="active"&gt;&lt;a href="#"&gt;';
    $config['cur_tag_close']  = '&lt;/a&gt;&lt;/li&gt;';
    $config['prev_link']                = '&amp;lt;';
    $config['prev_tag_open']        = '&lt;li&gt;';
    $config['prev_tag_close']        = '&lt;/li&gt;';
    $config['num_tag_open']       = '&lt;li&gt;';
    $config['num_tag_close']  = '&lt;/li&gt;';
    $this-&gt;pagination-&gt;initialize($config);
    //$data['video_reviews']= $this-&gt;Product_model-&gt;get_video_reviews($id);
    if(isset($_GET['v'])&amp;&amp;$_GET['v']==1)
        $data['show_video_review']=1;
    else   
       $data['show_video_review']=0;
  
  $this-&gt;template-&gt;write_view('content', 'product',$data, TRUE);
  $this-&gt;template-&gt;render();
  </code></pre>