My Structure of data will be like below
var data = {"Questions" : [
{"QID":"Q1","S":"2"},
{"QID":"Q2","T":"12"},
{"QID":"Q3","U":"22"}], // Also please suggest me to improve this to make parsing easier
"Share" : "Yes"
};
for(var item in data.Questions)
{
if(this.QID == "Q2") // this.QID returns me undefined
{
// I want to retrieve the total object i.e
// {"QID":"Q2","T":"12"} should be returned
}
}
Why does this.QID
return me undefined
? How can I retrieve the total object, i.e. {"QID":"Q2","T":"12"}
?