<html>
<body>
<h2>Content as Array.</h2>
<p>Content written as an JSON array will be converted into a JavaScript array.</p>
<p id="demo"></p>
<script>
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var myArr = JSON.parse(this.responseText);
document.getElementById("demo").innerHTML = myArr[0];
}
};
xmlhttp.open("GET.html", "json_demo_array.txt", true);
xmlhttp.send();
</script>
<p>Take a look at <a href="json_demo_array.txt" target="_blank">json_demo_array.txt</a></p>
</body>
<!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjson_ajax_array by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:28:16 GMT -->
</html>