Skip to content

Instantly share code, notes, and snippets.

@jb41
Created May 11, 2016 22:48
Show Gist options
  • Save jb41/6c7d11615eebce816986bf882ac70ef1 to your computer and use it in GitHub Desktop.
Save jb41/6c7d11615eebce816986bf882ac70ef1 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="https://code.jquery.com/jquery-3.0.0-alpha1.js"></script>
</head>
<body>
<ul id="characters-list"></ul>
<script>
var sheetsuUrl = "https://sheetsu.com/apis/v1.0/020b2c0f";
$.ajax({
url: sheetsuUrl,
dataType: 'json',
type: 'GET',
// place for handling successful response
success: function(data) {
addCharacters(data);
},
// handling error response
error: function(data) {
console.log(data);
}
});
addCharacters = function(characters) {
var list = $('#characters-list');
for(var i=0; i<characters.length; i+=1) {
char = characters[i];
html = "<li id=" + char.id + "><h3>" + char.name + "</h3><p>Score: " + char.score + "</p></li>";
list.append(html);
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment