Skip to content

Instantly share code, notes, and snippets.

@renzocastro
Created October 6, 2018 16:34
Show Gist options
  • Save renzocastro/5e5be729aa83a2409c9ebf3ee9f1aa64 to your computer and use it in GitHub Desktop.
Save renzocastro/5e5be729aa83a2409c9ebf3ee9f1aa64 to your computer and use it in GitHub Desktop.
JS XMLHttpRequest
const request = new XMLHttpRequest()
request.open('GET', 'https://jsonplaceholder.typicode.com/users', true);
request.onload = function () {
console.log('DONE', request.responseText);
};
request.onerror = function () {
console.log('FAIL', 'Error loading page');
};
request.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment