Last active
August 29, 2015 14:23
-
-
Save jtulk/0e38b033a3160e186b56 to your computer and use it in GitHub Desktop.
Trying out Bl.ocks.org with D3 and JSON-Generator
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 class="no-js" lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<title></title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<div id="chart"></div> | |
<script src="main.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
var r = new XMLHttpRequest(); | |
r.onreadystatechange = function () { | |
if (r.readyState != 4 || r.status != 200){ | |
alert('Request Failed'); | |
return false; | |
} else { | |
var data = JSON.parse(r.responseText); | |
processData(data); | |
} | |
}; | |
r.open("GET", "http://beta.json-generator.com/api/json/get/H6eos0I"); | |
r.send(null); | |
function processData(data){ | |
document.getElementById('chart').innerHTML = "Request succeeded"; | |
alert(data); | |
} |
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
* { | |
box-sizing: border-box; | |
} | |
#chart { | |
border: solid 2px black; | |
height: 300px; | |
width: 100%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment