Created
December 11, 2015 16:24
-
-
Save vaibhavmule/cd447d4f17369a9347d6 to your computer and use it in GitHub Desktop.
Make a HTTP request with XMLHttpRequest.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GET Request | |
var xhr = new XMLHttpRequest(); | |
// Three Arguments: Method, Url and true is optional boolean for async | |
xhr.open("GET", "http://example.com/", true); | |
// Log the response | |
xhr.onload = function () { | |
console.log(xhr.responseText); | |
}; | |
// Send the request | |
xhr.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment