Skip to content

Instantly share code, notes, and snippets.

@faddah
Created December 6, 2014 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faddah/cf686a94a80393ca7a63 to your computer and use it in GitHub Desktop.
Save faddah/cf686a94a80393ca7a63 to your computer and use it in GitHub Desktop.
why ain't dis AJAX function woikin'??!
<script>
var xhr = new XMLHttpRequest();
var bringItAJAXButton = document.getElementById('load');
xhr.onreadystatechange = function() {
if(xhr.readyState === 4) {
document.getElementById('ajax').innerHTML = xhr.responseText;
}
};
xhr.open('GET', 'sidebar.html');
function sendAJAX() {
xhr.send();
document.getElementById('load').style.display = "none";
}
bringItAJAXButton.addEventListener("click," sendAJAX);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment