The JSON:
{
"count": 1,
"rows": [
{
"user_id": "7",
"lat": "48.452583",
"lng": "-123.545052",
"distance": "0.4852177729308128"
}
]
}
This comes into my function(data) and I’m trying to access count and then the user_id ..
downloadUrl(searchUrl, function(data) {
alert( "Locations Found: " + data[0].count );
});
data.count, data[0].count … don’t work. And I’m drawing a blank as to how to access them.
If your
datais string (not data-type:json) then you need to parse it as followsThen use