简体   繁体   中英

Parse JSON response got from AJAX request through JavaScript

I'm geting a JSON response with an AJAX request through JavaScript.

Here is the response:

{"responseCode":400,"errors":false,"submitted":false,"content":"some content","notice":""}

My Goal is to get the content:

"some content"

The json variable is the data in my case. So, I have tried with:

data.content

But I am geting an empty string.

Any idea on how to access the string?

Thank you in advance.

Did you first parse json ?

var data = JSON.parse(json);

than read data.content

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