Created
October 1, 2018 14:15
-
-
Save manekinekko/445d08d7cfd58e8c24c97ce0f3d49b2d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<div id="content"></div> | |
<button id="load">Vador says...</button> | |
<script> | |
const content = document.querySelector('#content'); | |
const click = function() { | |
content.innerHTML = 'Luke, ...'; | |
fetch('/api/users/luke') | |
.then(response => response.json()) | |
.then(data => { | |
content.innerHTML = data.response; | |
}); | |
}; | |
document.querySelector('#load').addEventListener('click', click); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment