【发布时间】:2012-06-21 09:16:10
【问题描述】:
var Song = Backbone.Model.extend({
defaults: {
name: "Not specified",
artist: "Not specified"
},
initialize: function () {
document.write("Music is the answer");
},
url:function(){
return '/home/';
}
});
var Album = Backbone.Collection.extend({
model: Song
});
var song1 = new Song({
name: "How Bizarre",
artist: "OMC"
});
var song2 = new Song({
name: "Sexual Healing",
artist: "Marvin Gaye"
});
var song3 = new Song({
name: "Talk It Over In Bed",
artist: "OMC"
});
var myAlbum = new Album([song1, song2, song3]);
document.write(myAlbum.models); // [song1, song2, song3]
- 如何将
myAlbum.models对象发送到我的服务。 - 如何提醒我的网址
【问题讨论】:
-
你是什么意思:"alert my url" ?
-
同意@fguillen。这是进行批量更新/保存的解决方案。 stackoverflow.com/questions/5014216/…