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