Answer the question
In order to leave comments, you need to log in
How to insert a date into a collection?
function startContentCollection() {
app.Collections.contentCollection = Backbone.Collection.extend({
initialize: function() {
$.ajax({
url: 'main/cloth/1',
success: success,
dataType: 'text'
});
function success(data) {
console.log(data) //<--- Как вот это вставить в коллекцию?
}
},
model: app.Models.content
})
app.Global.contentCollection = new app.Collections.contentCollection(/*Тут должна быть коллекция*/)
}
Answer the question
In order to leave comments, you need to log in
You do it across the framework :) You need to call the fetch method on the collection (you can override it if necessary).
In general, to insert models into a collection, do Collection#set(<массив моделей>)
.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question