How Can We Help?
< Back
You are here:
Print

Array as JSON

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”, “json_demo_array.txt”, true);
xmlhttp.send();

Table of Contents