Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ajax based jquery data table sending columns as "columns"=>"[object Object]"

jQuery ajax data table is sending the parameters for filters as following array How to change it send actual value and name of column?

Parameters: {
"draw"=>"2", 
"columns"=>"[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]", "order"=>"[object Object]", 
"start"=>"0", 
"length"=>"10", 
"search"=>"[object Object]"
}
like image 450
Amol.D Avatar asked Feb 18 '26 03:02

Amol.D


2 Answers

Add fnServerData in your Datatable config.

 "fnServerData": function (sSource, aoData, fnCallback, oSettings) {

                $.ajax({
                    "dataType": 'json',
                    "type": "GET",
                    "url": "/Home/AjaxGetJsonData",
                    "data": oSettings.oAjaxData,
                    "Content-Type": "application/json",
                    "success": function (json) {
                       fnCallback(json);
                    }
                });

            }
like image 163
Pranay Soni Avatar answered Feb 20 '26 11:02

Pranay Soni


The same issue for me. I figured out that the reason was my past setting of jquery jQuery.ajaxSettings.traditional = true. Remove this setting works for me

like image 31
Massimiliano Bugatti Avatar answered Feb 20 '26 11:02

Massimiliano Bugatti