I am trying to access a .json
file from my localhost, but I am encountering some issues!
The contents of this file are shown below:
[
{"source":"tw1",
"text":"fubar"},
{"source":"tw2",
"text":"foo"}
]
To set up my localhost, I used the command: python -m http.server 8888 &
, which you can find more information about in the D3.js documentation.
Below is the javascript code that I have written:
<script type="text/javascript" src="lib/jquery-1.9.1.js"></script>
<script>
$(document).ready(
$.getJSON("http://localhost/test.json", function(data){
document.write(data);
});
</script>