Skip to content

Instantly share code, notes, and snippets.

View Ormadont's full-sized avatar

Evgeniy Pavlovich Demyanov Ormadont

  • Krost
  • Moscow, Russia
View GitHub Profile
@Ormadont
Ormadont / AJAXgetRequest.js
Created June 3, 2018 15:46
//boilerplate code for an AJAX GET request using an XMLHttpRequest object const xhr = new XMLHttpRequest(); const url = 'https://api-to-call.com/endpoint'; //xhr - XMLHttpRequest, it is a common practice to name this object xhr.responseType = 'json'; xhr.onreadystatechange = () => { //The purpose of this conditional statement checks to see if th…
//boilerplate code for an AJAX GET request using an XMLHttpRequest object
const xhr = new XMLHttpRequest();
const url = 'https://api-to-call.com/endpoint';
//xhr - XMLHttpRequest, it is a common practice to name this object
xhr.responseType = 'json';
xhr.onreadystatechange = () => {
//The purpose of this conditional statement checks to see if the request has finished.
if (xhr.readyState === XMLHttpRequest.DONE) {