Skip to content

Instantly share code, notes, and snippets.

@yuval-a
Last active August 31, 2015 09:15
Show Gist options
  • Save yuval-a/f192821551e12faaf2fe to your computer and use it in GitHub Desktop.
Save yuval-a/f192821551e12faaf2fe to your computer and use it in GitHub Desktop.
XMLHTTP GET Request
var url = '/.../';
var req = new XMLHttpRequest();
req.open('GET', url, true);
req.onreadystatechange = function () {
if (req.readyState == 4 && req.status == 200)
console.log(req.responseText);
else
console.log("Error loading page");
};
req.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment