D
D
Danil2015-10-10 14:35:09
JavaScript
Danil, 2015-10-10 14:35:09

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

1 answer(s)
K
Konstantin Kitmanov, 2015-10-10
@Veneomin

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 question

Ask a Question

731 491 924 answers to any question