title: Codeigniter AJAX pagination on click error
body: <p>I have a problem with jQuery. My codeigniter pagination is working, but when I add</p>
  
  <pre><code>        $(".search-pagination &gt; ul &gt; li &gt; a").on("click",function(e){
              e.preventDefault();
              $.ajax({
                  type: "GET",
                  url:$(this).attr('href')
              }).done(function(data) {
                  $(".grid-container-body").html(data.body);
                  $(".search-pagination").html(data.pagination_link);                 
              });             
          });
  </code></pre>
  
  <p>I have a error on <code>jquery.min.js</code> on this part </p>
  
  <pre><code> i.send(c.hasContent &amp;&amp; c.data || null), d = function(a, e) {
                          var h, j, k, l, m;
                          try {
                              if (d &amp;&amp; (e || i.readyState === 4)) {
                                  d = b, g &amp;&amp; (i.onreadystatechange = p.noop, cJ &amp;&amp; delete cI[g]);
                                  if (e) i.readyState !== 4 &amp;&amp; i.abort();
                                  else {
                                      h = i.status, k = i.getAllResponseHeaders(), l = {}, m = i.responseXML, m &amp;&amp; m.documentElement &amp;&amp; (l.xml = m);
                                      try {
                                          l.text = i.responseText
                                      } catch (a) {}
                                      try {
                                          j = i.statusText
                                      } catch (n) {
                                          j = ""
                                      }!h &amp;&amp; c.isLocal &amp;&amp; !c.crossDomain ? h = l.text ? 200 : 404 : h === 1223 &amp;&amp; (h = 204)
                                  }
                              }
                          } catch (o) {
                              e || f(-1, o)
                          }
                          l &amp;&amp; f(h, j, l, k)
                      }, 
  </code></pre>
  
  <p>this is a my function in controller </p>
  
  <pre><code>public function ordersItems()
  {
      $data = '';
      $orderby = ($this-&gt;uri-&gt;segment(3)) ? $this-&gt;uri-&gt;segment(3) : 'ponuda_id';
      $order = ($this-&gt;uri-&gt;segment(4)) ? $this-&gt;uri-&gt;segment(4) : 'asc';
      $this-&gt;load-&gt;library('pagination');
      $config['base_url'] = URL_PATH.'admin/orders/'.$orderby;
      $config['total_rows'] = (int)$this-&gt;m_administrator-&gt;itemsCount()['COUNT(orders_id)'];
      $config['per_page'] = 4;
      $config["uri_segment"] = 4;
      $this-&gt;pagination-&gt;initialize($config);
  
      $page = ($this-&gt;uri-&gt;segment(5)) ? $this-&gt;uri-&gt;segment(5) : 0;
      $data["result"] = $this-&gt;m_administrator-&gt;get($config['per_page'], $page, $orderby, $order);
      $data["pagination_link"]= $this-&gt;pagination-&gt;create_links();
      $data["order"] = $order;
      $data["orderby"] = $orderby;
      $is_ajax = $this-&gt;input-&gt;is_ajax_request();
      if(!$is_ajax){
          $data['user'] = $_SESSION['info'];
          $data['note'] = $this-&gt;m_administrator-&gt;getNotes($user = $_SESSION['info']['user_id']);
          $data['content'] = $this-&gt;load-&gt;view('admin/contents/orders', $data, true);
          $this-&gt;load-&gt;view('admin/admin',$data);
      }else{
          $output['body'] = $this-&gt;load-&gt;view('admin/contents/items/items-list', $data, true);
          $output['pagination_link'] =$data["pagination_link"].'
              &lt;script&gt;
                      $(document).ready(function() {
                          $(".search-pagination &gt; ul &gt; li &gt; a").on("click",function(e){
                              e.preventDefault();
                              $.ajax({
                                  type: "GET",
                                  url:$(this).attr("href")
                              }).done(function(data) {
                                  $(".tab-pane").html(data.body);
                                  $(".search-pagination").html(data.pagination_link);
                              });
                          });
                      });
              &lt;/script&gt;
                          ';
          $this-&gt;output
          -&gt;set_content_type('application/json')
          -&gt;set_output(json_encode($output));
      }
  }
  </code></pre>
  
  <p>on console I have a error  </p>
  
  <blockquote>
    <p>jquery.min.js:3246 GET <a href="http://localhost/site/admin/orders/orders_id/12" rel="nofollow">http://localhost/site/admin/orders/orders_id/12</a>  404 (Not Found) </p>
  </blockquote>
  
  <p>But if I copy this link and paste on browser is OK</p>