I'm trying to get specific information from a JSON file (Squarespace) with the aim of appending it to a <div>
. I need to loop through the data and get the location from each post. This is the code I'm using:
$.getJSON("http://www.theluxedit.com/?format=json-pretty", function(data) {
$.each(data, function(index, value) {
$('.locationData').append(data.items.location.addressLine2);
});
});
It will only work if I specifiy the item using an integer, such as:
$('.locationData').append(data.items[1].location.addressLine2);
This seems to be working for other examples I've tried, am I maybe getting the JSON concatenation wrong?