Created
May 11, 2016 22:48
-
-
Save jb41/6c7d11615eebce816986bf882ac70ef1 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> | |
<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