how i can get aaData object result ?
how i can get aaData object result ?
how i can get aaData result and put into array to populate another plugin like gmaps,highcharts ?
i have results like this:
{
"aaData": [
{
"name": "name1",
"values": "R$ 2778",
"totalUnidades": "188",
"dt_atual": "27/03/2007",
"coord": "-99.99,-99.99"
},
{
"name": "name2",
"values": "R$ 2916",
"totalUnidades": "120",
"dt_atual": "31/05/2008",
"coord": "-99.99,-99.99"
}
]
}
in datatables into:
"fnDrawCallback": function () {
// NEW ARRAY like [ [name1,R$ 2778] , [name2,R$ 2916] ... ]
// then call another plugin - highcharts,gmaps...
$('#myDiv').highcharts({ ...
series: [{
name: 'blabalbla,
data: [NEW ARRAY]
...
},
i thing this question is the same and very helpfull to others people.
thanks
Answers
I am running into a similar issue, there are some fields like sSearch that I can access directly using $_GET (e.g. $_GET['sSearch']), but there are other variables that contain objects or arrays that I am unsure of how to access their data.
I am using PHP and tried using json_decode to access it as both an object and as an associative array:
```php
<?PHP
// Object
$obj = json_decode($_GET['order']);
echo $obj->{'column'}; // Outputs null
echo $obj->{'dir'}; // Outputs null
// Associative array
<?php > ``` ?>$arr = json_decode($_GET['order'],true);
echo $arr['column']; // Outputs null
echo $arr['dir']; // outputs null
I even tried just exploding it in case it was being passed as a string:
```php
<?PHP
// Explodes $_GET['order'] into an array
$arrExplode = explode(":",$_GET['order']);
echo $arrExplode[0]; // Outputs null
<?php > ``` ?>echo $arrExplode[1]; // Outputs null
Ok, I figured out my problem:
```php
<?php > ``` ?><?PHP
echo $_GET['order'][0]['column']; // Outputs 2
echo $_GET['order'][0]['dir']; // Outputs asc
understand.
but my datatables works fine. i no need create 2 outputs from serverside. only get or convert actual response and put into fndwawcallback .
:(