Created
May 18, 2016 21:13
-
-
Save haarts/90207ba2fe77752b83b39fee72f63cf9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<ul id="list"> | |
<ul/> | |
<script type="text/javascript"> | |
var list = document.querySelector("#list"); | |
function createListItem(show) { | |
var link = document.createElement("a"); | |
link.setAttribute("href", show.url); | |
var linkText = document.createTextNode(show.name); | |
link.appendChild(linkText); | |
var item = document.createElement("li"); | |
item.appendChild(link); | |
return item; | |
} | |
fetch('shows.json').then(function(response) { | |
return response.json(); | |
}).then(function(shows) { | |
for (show of shows) { | |
list.appendChild(createListItem(show)); | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment