Quantcast
Viewing all articles
Browse latest Browse all 8068

Returning model instance on Backbone save

I am successfully creating a model and persisting it to my remote API using model.save();. I want to keep this instance of this model and proceed with further edits (like a multi-step form), so I need to hang on to the JSON object that is returned by my server. I have implemented a REST sync adapter similar to the BookClient example. By reading the Backbone documentation for the save method, it appears that I should pass in success and error callbacks as options when I call model.save() and retrieve the new object from the response. Is this the appropriate way to achieve this?


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>