Created
October 14, 2018 03:40
-
-
Save Franks-Joseph/3ad11cd83323afb89e460f2cb4583aff to your computer and use it in GitHub Desktop.
XHR_with_JSON created by Franks_Joseph - https://repl.it/@Franks_Joseph/XHRwithJSON
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>repl.it</title> | |
<link href="style.css" rel="stylesheet" type="text/css" /> | |
</head> | |
<body> | |
<script src="script.js"> | |
</script> | |
</body> | |
</html> |
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
{ | |
"Game": "Halo", | |
"Level": "Silent Cartogropher", | |
"Difficulty": "Legendary" | |
} |
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
const xhr = new XMLHttpRequest(); | |
xhr.onload = function() { | |
const jasonObject = JSON.parse(this.responseText); | |
alert(jasonObject.Game); | |
console.log("Success!"); | |
} | |
xhr.open('get', 'info.json'); | |
xhr.send(); |
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
Empty file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment