Created
September 25, 2017 13:52
-
-
Save Vlasterx/8af48c2172647f2a1fc66a89d2b4b18f to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/kubamuy
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var http = new XMLHttpRequest(); | |
var method = 'GET'; | |
var url = 'http://jsonplaceholder.typicode.com/posts'; | |
http.open(method, url); | |
http.onreadystatechange = function() { | |
if (http.readyState === XMLHttpRequest.DONE && http.status === 200) { | |
console.log(JSON.parse(http.responseText)); | |
} else if (http.readyState === XMLHttpRequest.DONE && http.status !== 200) { | |
console.log('Error loading JSON'); | |
} | |
}; | |
http.send(); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var http = new XMLHttpRequest(); | |
var method = 'GET'; | |
var url = 'http://jsonplaceholder.typicode.com/posts'; | |
http.open(method, url); | |
http.onreadystatechange = function() { | |
if (http.readyState === XMLHttpRequest.DONE && http.status === 200) { | |
console.log(JSON.parse(http.responseText)); | |
} else if (http.readyState === XMLHttpRequest.DONE && http.status !== 200) { | |
console.log('Error loading JSON'); | |
} | |
}; | |
http.send();</script></body> | |
</html> |
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 http = new XMLHttpRequest(); | |
var method = 'GET'; | |
var url = 'http://jsonplaceholder.typicode.com/posts'; | |
http.open(method, url); | |
http.onreadystatechange = function() { | |
if (http.readyState === XMLHttpRequest.DONE && http.status === 200) { | |
console.log(JSON.parse(http.responseText)); | |
} else if (http.readyState === XMLHttpRequest.DONE && http.status !== 200) { | |
console.log('Error loading JSON'); | |
} | |
}; | |
http.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment