Skip to content

Instantly share code, notes, and snippets.

@slamb2k

slamb2k/widget.html

Created Aug 7, 2017
Embed
What would you like to do?
Tile GetData
function GetData() {
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "https://api.mobile.azure.com/v0.1/apps/silamb/XamarinDevDays/analytics/events/NormalOrdering/properties/TimeTaken/counts?start=2017-07-24&count=10", false);
xhttp.setRequestHeader("Content-type", "application/json");
xhttp.setRequestHeader("X-API-Token", "a0a1a9dd0747e90d365a925ea3de9523d2beaf01");
xhttp.send();
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
You can’t perform that action at this time.