0
我無法訪問我的JSON對象屬性。鑑於此構造如何訪問JSON對象屬性
contractorTestQuestion = function (id, question, multianswer, textanswer, order) {
var cntrQuestion;
this.initialize(id, question, multianswer, textanswer, order);
}
$.extend(contractorTestQuestion.prototype, {
initialize: function (_i, _q, _m, _t, _o) {
cntrQuestion = {
"questid" : _i,
"question": _q,
"multianswer": _m,
"textanswer": _t,
"order": _o,
"answers": [],
"change": 'none'
}
},
addAnswer: function (a) {
answers.push(a);
},
getAnswer: function (idx) {
return this.answers[idx];
}
});
然後我在我的代碼是這樣創造的: VAR CQ =新contractorTestQuestion(QID,Q,M,T,tqQuesPos);
我想要做的是cq.question,並能夠獲得存儲在該字段中的值。
我想不通,我將它添加到一個私有變量做錯了什麼
是我看到正在使用的jQuery的擴展方法?可能也想用jquery來標記問題。 –
我看到的是JSON嗎? Err,[no](http://benalman.com/news/2010/03/theres-no-such-thing-as-a-json/)。可能要刪除對它的引用。 – Quentin