Ashwin Hegde
Ashwin Hegde

Reputation: 867

Nesting Backbone.js Fetch

this.Model.fetch({
    success: function() {
        ...
        <some code>
        ...

        this.Model.save({
            success: function() {
               alert("Success");
            }
        });
    }
});

I am trying to Save model and it is working well. But after saving the model the alert is not triggered.

Upvotes: 0

Views: 46

Answers (1)

Array out of bound
Array out of bound

Reputation: 1133

try this code

this.Model.fetch({
    success: function() {
        ...
        <some code>
        ...

        this.Model.save(null, {
            success: function() {
               alert("Success");
            }
        });
    }
});

http://backbonejs.org/#Model-save

model.save([attributes], [options]) 

save function has first argument as attributes

Upvotes: 2

Related Questions