I'm attempting to extract data JSON results and then placing the data in to a html table, unfortunately I haven't had any luck so far and was hoping to get some pointers with what I have created so far.
I would also like the option to only show some of the JSON results, so excluding some of the data.
JSON Results Website = http://asc.thecoin.pw/index.php?page=api&action=public
Below is what I have so far which doesn't work :(
Html Code:-
<!DOCTYPE html>
<html>
<body>
<h1>Asiccoin (ASC)</h1>
<div id="id01"></div>
<script>
var xmlhttp = new XMLHttpRequest();
var url = "http://asc.thecoin.pw/index.php?page=api&action=public";
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
myFunction(xmlhttp.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].pool_name +
"</td><td>" +
arr[i].hashrate +
"</td><td>" +
arr[i].workers +
"</td></tr>"
arr[i].shares_this_round +
"</td></tr>" +
arr[i].last_block +
"</td></tr>" +
arr[i].network_hashrate +
"</td></tr>" +
arr[i].fee +
"</td></tr>" +
arr[i].payout +
"</td></tr>";
}
out += "</table>";
document.getElementById("id01").innerHTML = out;
}
</script>
</body>
</html>
Any help would be much appreciated.