我的代码在本地运行良好,尝试将json从Windows转换为unix格式,并且文件被放入war文件中以进行部署-之后,我似乎无法读取该文件(csv文件也发生了同样的问题) ,似乎没有定义就退出Promise-任何建议将不胜感激。
SyntaxError: Unexpected token < in JSON at position 0
sovereignBondsPortlet.js:144 Uncaught (in promise) TypeError: Cannot read property 'objects' of undefined
at sovereignBondsPortlet.js:144
var dataset = d3.json("50m_unix.json").then(function(data) {
return data;
}).catch(console.log.bind(console));
var worldjson = dataset.then(function(world) {
var countries = topojson.feature(world, world.objects.countries).features;
topo = countries;
draw(topo);
});
答案 0 :(得分:0)
就像@Coderino所说,您可能会遇到某种服务器错误。您可能可以通过Chrome开发者工具获得更多详细信息,这是调试和调试代码的好方法。
network
标签。50m_unix.json
开头。