I am new to javascript and am trying to process a simple JSON response from an API. But when i run the following code i get nothing.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"> </script>
<script>
$(document).ready(function(){
$.getJSON('http://76.233.189.148:5000/index.json', function(result){
document.write(result.datasets);
});
});
</script>
</head>
<body>
</body>
</html>
I know the API is working since from:
http://76.233.189.148:5000/index.json
it returns:
{
"datasets": [
{
"id": "20150803-183949-44df",
"name": "Train0010",
"status": "Done"
}
],
"models": [
{
"id": "20150803-184058-97ff",
"name": "train0010_alex",
"status": "Done"
}
]
}
What am i doing wrong here?