Backbone Collection.fetch(), Parse Doesn't Work
I'm using backbone.js and I want to fetch data for my Collection from server: var Account = Backbone.Model.extend(); var AccountList = Backbone.Collection.extend({ model: A
Solution 1:
So, as WiredPrairie said, you need to change those lines:
accountList.fetch();
console.log(accountList.toJSON());
to:
accountList.fetch({
success: function(collection){
// This code block will be triggered only after receiving the data.console.log(collection.toJSON());
}
});
// JS will likely reach this line before receiving the data.
Post a Comment for "Backbone Collection.fetch(), Parse Doesn't Work"