Having crafted a backbone model, it looks like this:
var note_model = Backbone.Model.extend({
default : {
HistoryKey : "",
InsertDate : "",
MemberKey : "",
NoteDate : "",
ContactNote : "",
UserId : ""
},
initialize : function(note) {
this.HistoryKey = note.historykey;
this.InsertDate = note.insertdateUTC;
this.MemberKey = note.memberkey;
this.NoteDate = note.notedateUTC;
this.ContactNote = note.contactnote;
this.UserId = note.userid;
console.log(this.get('HistoryKey'));
}
});
Next, I have established a collection with a defined URL and populated the model using the fetch method of the collection. However, every time I attempt to access the model data using
model_object.HistoryKey
I can retrieve the data just fine. But when attempting to use
model_object.get("HistoryKey")
I receive an undefined value. The JSON data structure is as follows
{
"historykey": 4,
"insertdateUTC": "2013-11-15T23:21:44.247",
}
Interestingly, if I utilize
model_object.get("historykey")
The data comes through properly. So my question remains, why am I unable to retrieve the data using member.get("HistoryKey")?