I have a script that retrieves the value "average" from a JSON array
<p id="ticker"></p>
<script>
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
myObj = JSON.parse(this.responseText);
document.getElementById("ticker").innerHTML = myObj.average; };
xmlhttp.open("GET", "https://bitbay.net/API/Public/BTC/ticker.json", true);
xmlhttp.send();
</script>
I've been trying to figure out how to make the <p>
section refresh every few seconds with no success. If anyone could provide some guidance on this, I would greatly appreciate it.