How to do pagination on ajax response data

How to do pagination on ajax response data

avdivyaavdivya Posts: 2Questions: 1Answers: 0

I have done pagination, I have also done filtration with checkboxes with ajax to avoid page reload, but the issue is the pagination shows the old result. and when i choose page count its shows old result. How can i do the pagination and sorting with filtered data.

Answers

  • kthorngrenkthorngren Posts: 21,247Questions: 26Answers: 4,929

    Is this with serverside processing?

    Taking a look at your code will help in troubleshooting.

    Kevin

  • avdivyaavdivya Posts: 2Questions: 1Answers: 0
    edited March 2017

    For the first loading, i have done the following
    $(document).ready(function () {
    $('#ms_booking').DataTable();
    });
    then, i have some filter option, each will call a server side function.

             jQuery.ajax( {
            url : '<?php echo $this->basePath('cabin/index/sort'); ?>',
            dataType : "JSON",
            data : "jsonstring=" + encodeURIComponent(jsonData),
            type : "POST",
            contentType : "application/x-www-form-urlencoded",
            success : function(response, status, jqXHR) {
    
            $('#booking_result').html(response.result);
    
            },
            error : function(err) {
                alert(JSON.stringify(err));
            }
        });
    

    The result is same table structure with filtered result. it will be loaded in a div. But the issue is it is showing old result pagination and count.

This discussion has been closed.