This works fine and returns the JSON and dumps the lot in the browser. However, I am having trouble parsing the file and getting the details I want from it. The file is structured as so:
Say I want to get the colour for each floorplan item. How do I go about doing this? I was thinking something like:
$('#searchResults').html(json.floorplan.colour);
But it just returns the error
TypeError: Result of expression 'json.floorplan' [undefined] is not an object.
Any help is much appreciated!
EDIT: Never mind, fixed it myself. Apparently it was returning a string not an object so I had to use the eval() function to convert the string to an object. Now works perfectly!
This works fine and returns the JSON and dumps the lot in the browser. However, I am having trouble parsing the file and getting the details I want from it. The file is structured as so:
Say I want to get the colour for each floorplan item. How do I go about doing this? I was thinking something like:
$('#searchResults').html(json.floorplan.colour);But it just returns the error
Any help is much appreciated!
EDIT: Never mind, fixed it myself. Apparently it was returning a string not an object so I had to use the eval() function to convert the string to an object. Now works perfectly!