バックボーンコレクションがあります。フェッチします。サーバーはJSONで戻ってきます。コレクションに新しいデータを取り込むにはどうすればよいですか?これが私のコードです:
var Todos = Backbone.Collection.extend({
url: "server/todos-service.php", // this does what it is supposed to do so no worries!
model: Todo,
initialize: function(attributes, options) {
// IN HERE WHAT DO I HAVE TO DO?
// WHAT EVENT SHALL I BIND TO TO REACT THE DATA DELIVERY?
// AND WHAT SHALL I DO NEXT TO POPULATE THE DAMN THINGS
}
});
// CLIENT CODE
new Todos().fetch();
誰かがこれがどのように行われるべきか教えてもらえますか?
乾杯