I have this code
$.ajax({
type: "GET",
url: "/cgi-bin/ajax.pl",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: { "id" : id },
// ...
success: function(result){
if (result.error) {
alert('result.error: ' + result.error);
} else {
printObject(result);
}
}
});
where printObject outputs
responseText: Content-Type: application/json; charset=utf-8
{"276":"{\"var1\":[\"he\"],\"var2\":[\"he\",\"ki\",\"mt\"],\"var3\":\"07/06-2011\",\"var4\":[],\"var5\":\"ind\"}", ...
Question
How do I iterate over this hash?
Each array should just be treated as one variable. Ie. var2 would be he,ki,mt.
The result you got should already be parsed as json and it is available in
resultobject. Just doresult.276.var2to get the array.