Skip to content

Instantly share code, notes, and snippets.

@macdermott
Created September 3, 2020 18:20
Show Gist options
  • Save macdermott/d4a93b8f641048ffaeb99d82412b63aa to your computer and use it in GitHub Desktop.
Save macdermott/d4a93b8f641048ffaeb99d82412b63aa to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<title>JavaScript - read JSON from URL</title>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
</head>
<body>
<table class="availabilityTable">
<thead>
<tr>
<th>Location</th>
<th>Status</th>
<th>Count</th>
</tr>
</thead>
</table>
<script>
$.getJSON('https://prod-27.uksouth.logic.azure.com/workflows/669323ce5b794676bc7d3606cd31355a/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=VsDWkKvODDk5INqtaf901TR528qerxLlVUz77RvUVgU', function(data) {
var availability = data["value"];
for(var i=1;i<availability.length;i++)
{
var tr = document.createElement('tr');
var location = document.createElement('td').appendChild(document.createTextNode(availability[i]["1"]));
var status = document.createElement('td').appendChild(document.createTextNode(availability[i]["2"]));
var count = document.createElement('td').appendChild(document.createTextNode(availability[i]["Column1"]));
tr.appendChild(location);
tr.appendChild(status);
tr.appendChild(count);
$("#availabilityTable").html(tr);
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment