使用getJson加载文件并处理数据。
在success函数中,您将拥有一个 JSON 对象。
至于将数据存储在 CSV 文件中:是的,您可以,但您必须解析它
编辑:这种方法需要 jQuery。
对于纯 Javascript:
- 进行 AJAX 调用以获取文件的内容
- JSON.parse()响应。
为了进行 AJAX 调用,您还应该熟悉服务器端脚本语言。
在 php 中(比方说getQuiz.php):
<?php
     $data = file_get_contents ('quiz');
     echo json_encode($data);
?>
因此,发出 GET 请求,getQuiz.php响应将是quiz编码为 JSON的文件内容
var xmlhttp;
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState==4 && xmlhttp.status==200) {
        // Here you have your response
        quiz_data = JSON.parse(xmlhttp.responseText);
        // Other code
    }
}
xmlhttp.open("GET","getQuiz.php",true);
xmlhttp.send();