未捕获的ReferenceError:未定义d3 [英] Uncaught ReferenceError: d3 is not defined
问题描述
我是Web开发的新手,我正在尝试将基于D3的JS可视化上传到Weebly域。我已将所有必需的文件上传到我的Weebly网站,并在JavaScript中正确引用它们,但仍然获得未捕获的ReferenceError:d3未在此行上定义错误:
I am new to web development and I am trying to upload a D3-based JS visualization to a Weebly domain. I have uploaded all required files to my Weebly site and referenced them properly in the JavaScript, but keep getting an Uncaught ReferenceError: d3 is not defined error on this line:
d3.csv("http://subdomain.weebly.com/files/theme/force.csv", function(error, links) {
我尝试调用d3加载CSV文件进行可视化。我似乎无法找出问题所在。
Where I try to call d3 to load in a CSV file for my visualization. I can't seem to find out what the problem is.
另外,我用这行代码将d3(本地托管)加载到JS中:
Also, I loaded d3 (hosted locally) into the JS with this line:
<script src="http://subdomain.weebly.com/files/theme/d3.js" charset="utf-8"></script>
并尝试远程链接到d3,但仍然会出现同样的错误。
and also tried to link to d3 remotely, but still get the same error.
这让我非常困惑,因为我的本地主机上一切正常。
This has me very confused because everything works fine on my localhost.
谢谢!
推荐答案
在html中插入以下内容
insert the following into your html
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
这篇关于未捕获的ReferenceError:未定义d3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!