Created
December 6, 2014 23:05
-
-
Save faddah/cf686a94a80393ca7a63 to your computer and use it in GitHub Desktop.
why ain't dis AJAX function woikin'??!
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
<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