It is a function that Backbone calls every time to read or save the model to the server. It represents the state of the model.
sync.(method, model, options)
method − It represents the CRUD operations such as create, read, update and delete.
model − It includes the model to be saved.
options − It fires success or error messages depending on the method succeeded.
Let us carry out the following steps to see how the above code works −
Save the above code in the backbone-sync.htm file.
Open this HTML file in a browser.