Created
November 24, 2012 17:10
-
-
Save 0i0/4140557 to your computer and use it in GitHub Desktop.
Short Ajax
This file contains hidden or 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
var xhr = new XMLHttpRequest() | |
var url = 'http://' | |
xhr.open("GET",url,false) | |
xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8") | |
xhr.send(null) | |
if (xhr.status==200){ | |
var data = JSON.parse(xhr.responseText) | |
console.log(data) | |
} else { | |
console.log('error') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment