Reputation: 6664
When I call save on a Backbone model...
model.save();
...Backbone expects a JSON response from the server, which it uses to update the model.
How do I prevent Backbone from updating the model when save is called?
Upvotes: 1
Views: 901
Reputation: 336
Maybe you should just use model.set(attributes, [options])
Model-set.
A "change" event will be triggered on the model. No HTTP POST
/PUT
request
model = new Application({id: 1, title: 'test'})
model.set({attr: 'value', key: 'val'})
model.toJSON()
// => {id: 1, title: "test", attr: "value", key: "val"}
Upvotes: 1
Reputation: 6044
One way to do it
model.clone().save()
Original model
will remain unchanged.
Upvotes: 4