Skip to content

Instantly share code, notes, and snippets.

@cmvandrevala
Created March 15, 2017 17:43
Show Gist options
  • Save cmvandrevala/ed41290d828640139b8b4ea40756dbf0 to your computer and use it in GitHub Desktop.
Save cmvandrevala/ed41290d828640139b8b4ea40756dbf0 to your computer and use it in GitHub Desktop.
XMLHttpRequest for CORS Demonstration
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://localhost:3000');
xhr.onload = function() { console.log(xhr.responseText); }
xhr.onerror = function() { console.log("There was an error!"); }
xhr.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment