首页 > 解决方案 > D3.js 加载资源失败:服务器响应状态为 404(未找到)

问题描述

我正在尝试教程,但未加载域请求。链接工作正常,但我仍然收到错误消息。我正在使用 D3.js 处理仪表板。我感谢您的帮助!

d3.json("https://oec.world/attr/country/", function(country_error, countries) {
  if (country_error) return console.arn(country_error);
  countries.data.forEach(function(d) {
    country_attrs[d.id] = d;
  });
});

d3.json("https://oec.world/hs/export/2011/show/all/all/", function(error_2011, json_2011) {
  if (error_2011) return console.warn(error_2011);
  json_2011.data.forEach(function(d) {
    data[d.origin_id] = {
      "export_val_2011": d.export_val,
      "id": d.origin_id
    }
  });

  d3.json("https://oec.world/hs/export/2010/show/all/all/", function(error_2010, json_2010) {
    if (error_2010) return console.warn(error_2010);
    json_2010.data.forEach(function(d) {
      if(data[d.origin_id]) {
        data[d.origin_id]["export_val_2010"] = d.export_val
      }
    });

标签: javascripthtmld3.jsdashboard

解决方案


推荐阅读