Reputation: 683
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);}
Upvotes: 3
Views: 117
Reputation: 2397
"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"
}
};
Upvotes: 0
Reputation: 29166
You probably need to access the property using the square bracket notation. Try -
alert("sdf" + data["doc._id"]);
Upvotes: 4