0
votes

I have a backbone model. Now I want to update the model on server side, so I call model.save(); now as backbone.js makes an ajax call to server with PUT request. If the server fails to process this request, it sends some error code to client.

Now my question is, client has model's updated state, and server has an old state, both are inconsistent. Now on error() callback of my model.save() I want to revert the model to old state, how would I do it? Does backbone keeps copy of old state with it?

1

1 Answers

0
votes

try using

oldMOdel = newModel.previousAttributes();

check out this