3

I am trying to get data from an object. I have tried to get the data as a.doc._id as given below.

function ab(data){alert("content is "+data.doc.id);}

enter image description here

2

2 Answers 2

4

You probably need to access the property using the square bracket notation. Try -

alert("sdf" + data["doc._id"]);
Sign up to request clarification or add additional context in comments.

Comments

0

"doc" is not an object, as shown in the inspector, you should rename the property name to something like doc-title instead.

Otherwise, you should create the object something like this

var data = {
             "act" : "",
             "doc": {
                 "_id" : "9",
                 "title": "fghfgh"
             }
           };

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.