Skip to content

Passing json variable to bootgrid table #434

@amoriotechnology

Description

@amoriotechnology

I am trying to use ajax function in codeignitor to fetch data from the database and show the results in the bootgrid table.
I received a valid json from controller. My json response is https://pastebin.com/As7gehP6

My script :

            $(function() {
                        var data = {
                            csrfName: csrfHash
                        };
                        $.ajax({
                                type: 'POST',
                                data: data,
                                dataType: "json",
                                url: '<?php echo base_url();?>Cinvoice/CheckProfarmaInvoiceList',
                                success: function(json, statut) {
            
                                    localStorage.setItem('json', JSON.stringify(json));
                                });
                        });


              var grid = $("#document_data").bootgrid({
                  ajax: false,
                  url: '<?php echo base_url();?>Cinvoice/CheckProfarmaInvoiceList'
              }); 

             grid.bootgrid('append', localStorage.getItem('json'));

But data is not displaying in bootgrid table,the table is empty and Showing 1 to 10 of 1792 entries
My output is :
git

Kindly helpme to solve this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions