I’m trying to retrieve some data from a JSON response, but this doesn’t seem to work:
My javascript code:
function recommend(response){
var recommendedList = eval('(' + response.responseText + ')');
$H(recommendedList).each(function(item){
alert(item.artist);
});
}
What I want is to retrieve each artist values from the JSON response.
and the JSON response is of the format:
[
{"artist":"artist1","location":{"lat":"50.952226","lng":"5.34832","ID":28}},
{"artist":"artist2","location":{"lat":"52.362287","lng":"4.883965","ID":32}},
...
]
A little help would be great. Thanks!
Guessing from the “$H()” that you’re using prototype, I’d just get rid of that “$H()” because the array should already be iterable.