Backbone.JS Sync()

The Backbone.JS Sync() model communicates with the server and also represents state of a model.


Model.Sync (method, model, options)

method: This parameter is used to specify the create, read, update and delete operations, also called as the CRUD operations.
model: This parameter is used to save the data on the model.
options: This parameter is used to fire SUCCESS or ERROR messages.


<!DOCTYPE html>  
<script src="" type="text/javascript"></script>  
<script src="" type="text/javascript"></script>  
<script src="" type="text/javascript"></script>  
<script type="text/javascript">  
var details = new Backbone.Model({  
subject: "Hello!",  
msg: "Welcome."   
Backbone.sync = function(method, model) {  
document.write(method + ": " + model.get('subject')+ " " +model.get('msg'));  


create: Hello! Welcome.
Please Share