Javascript 使用Tabletop.js,尝试从数组中获取数据 问题

Javascript 使用Tabletop.js,尝试从数组中获取数据 问题,javascript,jquery,arrays,object,tabletop.js,Javascript,Jquery,Arrays,Object,Tabletop.js,正在尝试从此数组中提取数据,该数组当前包含两个对象。我正在使用Tabletop.js从一个公共的Google电子表格中获取数据,控制台中出现一个错误,上面写着ReferenceError:object未定义 慰问 scripts.js 我认为您没有在第二个函数showInfo中定义数据 我认为最好的方法是为桌面模型创建一个变量,比如 var tabletop = Tabletop.init( { key: public_spreadsheet_url, callback: function(da

正在尝试从此数组中提取数据,该数组当前包含两个对象。我正在使用Tabletop.js从一个公共的Google电子表格中获取数据,控制台中出现一个错误,上面写着
ReferenceError:object未定义

慰问 scripts.js
我认为您没有在第二个函数showInfo中定义数据

我认为最好的方法是为桌面模型创建一个变量,比如

var tabletop = Tabletop.init( { key: public_spreadsheet_url, callback: function(data, tabletop) { console.log(data) }, simpleSheet: true });
那么你可以称之为:

$("#myDiv").html(tabletop.data()[1].Statement);
var tabletop = Tabletop.init( { key: public_spreadsheet_url, callback: function(data, tabletop) { console.log(data) }, simpleSheet: true });
$("#myDiv").html(tabletop.data()[1].Statement);