KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

DataTables Create Error #1175

Open sevgi opened this topic on on Nov 21, 2019 - 4 comments

sevgi commented on Nov 21, 2019

DataTables warning: table id=DTissueReport - Ajax error. For more information about this error, please see http://datatables.net/tn/7

code:

DataTables::create(array(
                "name" => "DT" . $this->reportName,
                "dataSource" => function () {
                    return $this->getDataSource()->query($this->query);
                },

                "serverSide" => true,
                "method" => 'post',
                "showHeader" => true,
                "showFooter" => true,
                "columns" => array(
                    "CODE" => array("label" => "code"),
                ),
                "cssClass" => array(
                    "table" => "table-bordered"
                ),
                "options" => array(
                    "processing" => true,
                    "searching" => true,
                    "paging" => true,
                    "colReorder" => true,
                    "order" => [],
                    "pageLength" => 25,
                    "fixedHeader" => true,
                    "oLanguage" => array(
                        "sLengthMenu"=> "_MENU_ kayıt göster",
                        "sZeroRecords" => "Hiç kayıt yok",
                        "sInfo" => "kayıt",
                        "sInfoEmpty" => "",
                        "sSearch" => "Filtrele/Ara",
                        "oPaginate" => array("sPrevious" => "Önceki", "sNext" => "Sonraki")
                    ),
                ),
            ));
David Winterburn commented on Nov 22, 2019

Hi,

Do you use DataTables in any framework like Laravel? Thanks!

paulo commented on May 22

I am receiving the same error , I use Laravel and I do use DateTables what was the resolution here? thank you

David Winterburn commented on May 25

Hi Paulo,

In case you use DataTables' serverSide in Laravel, there could be problem if your Laravel setup enables CSRF Protection. In that case DataTables' ajax call to retrieve new data won't pass CSRF by default. To solve this problem please try the following method:

  1. Add the following tag to your report view page:
<meta name="csrf-token" content="{{ csrf_token() }}" />
  1. Add the following script to your report view page as well:
<script type="text/javascript">
$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});
</script>

Let us know if this solves your issue. Thanks!

paulo commented on May 26

thanks, going to update through https://www.koolreport.com/forum/topics/1454#p7856

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None