Skip to content

Instantly share code, notes, and snippets.

@GoesToEleven
Created July 17, 2015 23:50
Show Gist options
  • Save GoesToEleven/02f6af5cb63e34347c19 to your computer and use it in GitHub Desktop.
Save GoesToEleven/02f6af5cb63e34347c19 to your computer and use it in GitHub Desktop.
AJAX
var request = new XMLHttpRequest();
request.open('GET', 'data.txt');
request.addEventListener('readystatechange', function() {
if ((request.status === 200) && (request.readyState === 4)) {
myNode = document.querySelector('body');
myNode.innerHTML = request.responseText;
console.log('new way');
} //ready
});
request.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment