var ListView = Backbone.View.extend({
el: $('hello'),
initialize: function() {
var stuff = new FieldCollection();
var output;
stuff.parse();
stuff.fetch({
success: function (collection, response) {
console.log(response);
output=response;
return response;
}
});
this.render(output);
},
render:function(output){
console.log(output);
$(this.el).append("<button id='add'>hiii</button>");
$(this.el).append("<button id='removeAll'>Remove all list item</button>");
}
});
在这里,我试图在output
变量中捕捉响应的值......但它正在出现“未定义”。有什么想法我错了吗?