i work with d3.js and CodeIgniter and i have a problem when i get json data with d3.json
when i run this code :
var url = "http://probe.dev/draw/windRose?station=vp2&sensors=wind&Since=2012-10-15T00:00:00&StepUnit=DAY&StepNbr=6;
d3.json(url, function(d) {
console.log(d); // print NULL in console
}
but it works with
$.getJSON(url, function(d) {
console.log(d); // print my data object correctly
}
my php code is :
<?php
@ob_end_clean();
header('Content-Type: "application/json"');
header('Content-Disposition: attachment; filename="data.json"');
header("Content-Transfer-Encoding: binary");
header('Expires: 0');
header('Pragma: no-cache');
header("Content-Length: ".strlen($data));
exit($data);
I don’t understand why d3.json do not work ?
I couldn’t make it work with v2, I moved to d3js.v3 and it worked.
The callback function in v3 takes two params: