x
1
<h2>内容是数组</h2>
2
<p>内容是数组会转换为 JavaScript 数组。</p>
3
4
<p id="demo"></p>
5
6
<script>
7
var xmlhttp = new XMLHttpRequest();
8
xmlhttp.onreadystatechange = function() {
9
if (this.readyState == 4 & this.status == 200) {
10
myArr = JSON.parse(this.responseText);
11
document.getElementById("demo").innerHTML = myArr[1];
12
}
13
};
14
xmlhttp.open("GET", "/examples/json-demo-array/full.json", true);
15
xmlhttp.send();
16
</script>
17
18
<p>查看服务端数据 <a href="/examples/json-demo-array/full.json" target="_blank">json-demo-array</a></p>