Need Help Parsing JSON code
Hey guys. I am new to parsing JSON. I am trying to use jQuery to parse through a json file but it doesn't seem to be working .
I am using firebug to debug this. I can see that the data has been parsed from the $.parseJSON function, but when I hover over the json var it says "undefined"
Anyone know what I might be doing wrong here?? Below is my code
- <script>
$(function(){
$.getJSON('json.json', function (data) {
var json = $.parseJSON(data);
$("#result").html(json.name);
});
});
</script>
</head>
<body>
<div id="result"></div>
</body>
Here is my JSON file
- { "name": "eldan" }