Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
109
rated 0 times [  113] [ 4]  / answers: 1 / hits: 42823  / 8 Years ago, thu, august 11, 2016, 12:00:00
[{id:7,message:This is another test message,taker_id:131,giver_id:102,status:0,stamp:2016-08-11}]


That's my response. I try to get a datum. I have tried data.id but it fails and returns undefined.


More From » json

 Answers
10

As I assume that you are working with a JSON string, you first have to parse the string into and JSON object. Else you couldn't reach any of the properties.



parsedData = JSON.parse(data);


Then you can get your property:



parsedData[0].id

[#61066] Tuesday, August 9, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lucianod

Total Points: 667
Total Questions: 106
Total Answers: 92

Location: Jordan
Member since Thu, Aug 5, 2021
3 Years ago
lucianod questions
;