私はd3.jsとCodeIgniterを使用していますが、このコードを実行するとd3.jsonでjsonデータを取得すると問題が発生します:
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
}
しかし、それは
$.getJSON(url, function(d) {
console.log(d); // print my data object correctly
}
私のphpコードは次のとおりです。
<?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);
d3.json が機能しない理由がわかりません。