问题描述
我在读取 JSON 文件后立即在 Chrome 中收到此错误.它可以在 Safari 和 Firefox 中正常运行.
I get this error in Chrome immediately after reading a JSON file. It works correctly in Safari and Firefox.
console.log ("事件 -> "+ postcards.nodes[0].node.event);//Safari 中的 "tally" "TypeError: Cannot read property 'node' of undefined" 在 Chrome 中.<
console.log ("event -> "+ postcards.nodes[0].node.event); // "tally" in Safari "TypeError: Cannot read property 'node' of undefined" in Chrome.<
嵌套 JSON 文件中的级别是否有限制?我从 Drupal 视图生成 JSON.这里是开始:
Is there a limit to the levels in a nested JSON file? I generate the JSON from a Drupal view. Here here is the start:
{"nodes":[{"node":{"w1":"","w2":"1","w3":"","w4":"", ...<
这里是 Javascript:
Here is the Javascript:
d3.json(
"/sites/default/d3_files/json/toronto-wards.json",
function(error,wards) {
d3.json("/postcards-json", function(error, postcards) {
console.log ("event -> "+ postcards.nodes[0].node.event); // tally in Safari
我正在使用 macOS,而我的朋友使用 Windows 在 Firefox 中遇到了同样的错误.
I'm using macOS and my friends using Windows get the same error in Firefox.
根据要求,我认为这是 XHR 消息:
As per request here is what I think is the XHR message:
d3.min.js:1 XHR finished loading: GET "http://www.stopplastics.ca/postcards-json".
推荐答案
问题是由于 Drupal 视图没有正确创建造成的.与 Chrome 浏览器无关.
The problem was caused by the Drupal view not being created correctly. Nothing to do with the Chrome browser.
这篇关于在某些(不是全部)浏览器中读取 D3 javascript 中的 JSON 文件时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)