JSON 是 JS 对象的字符串表示法,它使用文本表示一个 JS 对象的信息,本质是一个字符串。有关于json的相关信息,可参考:json百度百科。
1、HTML文档
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Read Json File</title>
<link href="https://fonts.googleapis.com/css?family=Faster+One" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
</header>
<section>
</section>
<script src="js/readJSON.js"></script>
</body>
</html>
2、js文档:readJSON.js
//获取<header>和</section>