我有以下html:
<html>
<head>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {'packages': ['geomap']});
google.setOnLoadCallback(drawRegionsMap);
function drawRegionsMap() {
var data = google.visualization.arrayToDataTable([
['Country', 'Money', ''],
['US', 80.21, 'United States']
['JP', 10.01, 'Japan']
...
]);
var options = {};
var geomap = new google.visualization.GeoMap(document.getElementById('chart_div'));
geomap.draw(data, options);
};
</script>
</head>
<body>
<div id="chart_div" style="width: 750px; height: 550px;"></div>
</body>
</html>
我需要直接读取具有以下内容的 .txt 文件:
['Country', 'Money', ''],
['US', 80.21, 'United States']
['JP', 10.01, 'Japan']
并填充此处使用的数组:
var data = google.visualization.arrayToDataTable([...]);
我怎样才能使它成为javascript?
谢谢丹尼尔