Answer the question
In order to leave comments, you need to log in
How does Backbone.Model.Fetch() work (does not update the model)?
I started to study Backbone, here is a piece of code that should pull data from the server into the model.
window.book = new App.Models.Book({id: 1});
book.fetch({reset: true, success: fetchSuccess});
var fetchSuccess = function(book) {
alert(book.get('title'));
};
When fetch() is called, the /books/1 request is sent, the chrome console confirms that the request has occurred and displays the desired book in response:
{"attributes":{"id":1,"title":"Lorem Ipsum","author" :"Dolor Sit Amet","isread":0},"original":{"id":1,"title":"Lorem Ipsum","author":"Dolor Sit Amet","isread":0} ,"relations":[],"exists":true,"
author: 'author',
isRead: false } Can you tell me
how fetch works, and what's the problem with not populating the model?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question