Backbone中的RESTful持久化

   1 从服务端获取数据

var BookShelf = Backbone.Collection.extend({
    model: Book,
    url: '/todos'
});

var bookshelf = new BookShelf();
bookshelf.fetch();

   2 将数据保存到服务端

book.save();

bookshelf.create({title: 'Backbone in Action'});

   3 从服务端删除数据

book.destroy();

相关推荐