你能帮忙处理点击事件吗?这是我的代码。
$(function() {
var Trainee = Backbone.Model.extend();
var TraineeColl = Backbone.Collection.extend({
model: Trainee,
url: 'name.json'
});
var TraineeView = Backbone.View.extend({
el: "#area",
template: _.template($('#areaTemplate').html()),
render: function() {
this.model.each(function(trainee){
var areaTemplate = this.template(trainee.toJSON());
$(this.el).append(areaTemplate);
},this);
return this;
}
});
var trainee = new TraineeColl();
var traineeView = new TraineeView({model: trainee});
trainee.fetch();
trainee.bind('reset', function () {
traineeView.render();
});
});
我的 o/p after(trainee.toJSON) 是
Sinduja
E808514
HPS
Shalini
E808130
HBS
Priya
E808515
HSG
o / p一切都很好......现在我想在点击按钮后得到这个o / p oly......