I need to read a .json
file from my localhost, but it didn't work!
The contents of the file are as follows:
[
{"source":"tw1",
"text":"fubar"},
{"source":"tw2",
"text":"foo"}
]
I set up the localhost with the command: python -m http.server 8888 &
, which is posted D3.js here.
I wrote the following javascript code:
<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>