i am little new to javascript..Can anyone help me out from here.My JSON Response is like below:And i want to parse it and show it in the Table.
And my javascript code is below:
function parseData() {
var xmlhttp = new XMLHttpRequest();
var url = "http://beta.json-generator.com/api/json/get/NJqfdNMx-";
xmlhttp.onreadystatechange=function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this.responseText);
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
function myFunction(response) {
var arr = JSON.parse(response);
var i;
var out = "<table>";
for(i = 0; i < arr.length; i++) {
out += "<tr><td>" +
arr[i].text +
"</td><td>" +
arr[i].text +
"</td><td>" +
arr[i].text +
"</td></tr>";
}
out += "</table>";
document.getElementById("id01").innerHTML = out;
}
}
var response = $.parseJSON(data);it is.My JSON Response is like below- there is no JSON below ... only your script. Did you forget to add it to the question?