having an issue with simple JSON parsing, wondering if someone could quickly spot any errors in this syntax?
function getFavs() {
$.getJSON('http://www.example.com/scripts/test.json', function(data) {
$('#main-content').html(data.foo);
});
}
the JSON file is as follows:
{
"foo": "The quick brown fox jumps over the lazy dog.",
"bar": "ABCDEFG",
"baz": [
52,
97
]
}
For some reason it doesn't like the 'data.foo' bit. I can use static data, but it's definitely not reading / parsing the JSON data. Not sure if it has to do with the URL I am using? (The file has been validated using JSONLint)
thanks for any clues.