简体   繁体   中英

JSON Object property is undefined

I make an AJAX call to fetch some data, get the data back as a JSON Object (not a string). When I log the object, I get the correct object and it's properties. However, when I try to log one of the objects properties, I get undefined.

For a screenshot of my code: http://i.imgur.com/gnt3w.gif

For a screenshot of the console log: http://i.imgur.com/DO09m.gif

What am I doing wrong?

It looks like your POST is returning data in an array, not as an individual object. I bet if you log data[0].bursary_name , you will see the correct logged output.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM