After being stuck on this problem for 8 hours, I finally decided to seek help:
In my JavaScript file, I am attempting to extract data from a REST API response. The response consists of an array of objects structured like this:
[{"start":"2017-04-21 14:40:00","hire":"no","address":"The
Monument","offer_id":"z554"},
{"start":"2017-04-21 14:40:00","hire":"no","address":"The
Gate","offer_id":"z123"},
{"start":"2017-04-21 14:40:00","hire":"yes","address":"The
Port","offer_id":"z999"}] }
I specifically need to extract the address value from each object so that I can use it as an argument in another function called updateAddressBook().
As far as I know, the response data is in JSON format. Therefore, I will need to parse it into a JavaScript object, then iterate through the array to retrieve the address information.
$.get('http://xxxx/,
function (data) {
var obj = $.parseJSON(data);
$.each(obj.data, function (index, value) {
updateAddressBook(address)
}
});
It's clear that this code is not correct, so I'm hoping someone can point out where I've gone wrong!
Any assistance would be greatly appreciated, Thank you!