In general, D3 has not prioritized really robust AJAX support the way that jQuery and other libraries have, because that's not its focus - so if you want to load a wide variety of external resources, like json data, you should probably do so with a 3rd-party library that has more support for carefully tweaked AJAX calls.

Or simply using XMLHttpRequest wrapped in a makeRequest function:

function makeRequest(url, callback) {
    var xhr = new XMLHttpRequest();"GET", json_path, true);
    xhr.setRequestHeader("Content-type", "application/json");
    xhr.onreadyStatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
    xhr.onerror = function(error) {
        throw error;

makeRequest(json_path, function(json_response) {
    //here you can use D3 to load your json as you want

Related Query

More Query from same tag