0

Is it possible to generate CI pagination via ajax sending page numbers through ajax instead of $config['url_segment'].

$(document).on("click",".pagination li a",function(event) {
    event.preventDefault();
    var segment = $(this).attr("data-ci-pagination-page");
    if(!segment){
        segment = 0;
    }
    $.ajax({
            method: "POST",
            url: "<?php echo base_url(); ?>login/function",
            data: {limit: segment}
        }).done(function($data){
            $("#contents").html($data);
        });

});

if I pass pagination variables through ajax how can I config them.

enter image description here

Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85
KBK
  • 375
  • 1
  • 4
  • 20
  • What is the problem in the code that you have ? – Sulthan Allaudeen Jun 19 '15 at 09:40
  • (1) I cant handle multiple pagination. (2) necessary to load data through `ajax` in case if pagination send data through `url segment` I cant Manage both `ajax` and `php` in same time – KBK Jun 19 '15 at 09:41
  • I guess you wan't to have navigation and pagination (All in ajax calls) Isn't it ? – Sulthan Allaudeen Jun 19 '15 at 09:45
  • I have to load table of details. that `table details` should change according to `select > options` .. each time `pagination` also should be appear according to the `row count`. so I create a `function` which `echo` all the `html` to the view `pagination` also working but the `pagination` only shows three numbers (fixed). – KBK Jun 19 '15 at 10:28
  • 1
    Why not you do [Data Tables](https://www.datatables.net/) ? – Sulthan Allaudeen Jun 19 '15 at 10:30
  • Thanx.. anyway cant we handle `Codeigniter pagination` via `ajax` – KBK Jun 19 '15 at 11:10
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/81000/discussion-between-sulthan-allaudeen-and-kanishka-b-kodithuwakku). – Sulthan Allaudeen Jun 19 '15 at 11:12

0 Answers0