Skip to content

Instantly share code, notes, and snippets.

@valokafor
Last active March 30, 2017 02:50
Show Gist options
  • Save valokafor/34052c75ebd66fdd4bc2960aeca78647 to your computer and use it in GitHub Desktop.
Save valokafor/34052c75ebd66fdd4bc2960aeca78647 to your computer and use it in GitHub Desktop.
<script>
function show() {
if(document.getElementById('benefits').style.display=='none') {
document.getElementById('benefits').style.display='block';
}
return false;
}
function hide() {
if(document.getElementById('benefits').style.display=='block') {
document.getElementById('benefits').style.display='none';
}
return false;
}
</script>
fetch(url) // Call the fetch function passing the url of the API as a parameter
.then(function() {
// Your code for handling the data you get from the API
})
.catch(function() {
// This is where you run code if the server returns any errors
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment