Skip to content

Instantly share code, notes, and snippets.

Created August 7, 2017 00:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save slamb2k/b836011403f777853696e2b16e94ef1c to your computer and use it in GitHub Desktop.
Tile GetData
function GetData() {
var xhttp = new XMLHttpRequest();"GET", "", false);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.setRequestHeader("X-API-Token", "a0a1a9dd0747e90d365a925ea3de9523d2beaf01");
var response = JSON.parse(xhttp.responseText);
total = 0;
for (i = 0; i < response.values.length; i++) { //loop through the array
total += +response.values[i].name / response.values.length; //Do the math!
document.getElementById('tileValue').innerHTML = total.toFixed(3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment