Basically I want to fetch a JSON file and store it in a model. However, when I try to access the attributes via get()
it returns undefined. So lets
I don't know if it's a typo or not but you are not passing model
to the callback
instplayer.on('change', function(){
console.log(model);
console.log(model.get(games));
})
it should be
instplayer.on('change', function(model, options){
console.log(model);
console.log(model.get("games"));
})
then games
must be a string
not a variable
.
Another thing I suggest you to be aware of is what the json
returns; sometimes you have to override the parse
function to get the exact results.
Again if your fetching an array
and not a single object, maybe you should use a collection
of players