Backbone.js: Sync Cheat Sheet

MethodsSyntaxDescription
Backbone.syncsync.(method, model, options)
It persists the state of the model to the server. Parameters:
method −  the CRUD method ("create""read""update", or "delete" )
model − the model to be saved (or collection to be read)
options − success and error callbacks, and all other jQuery request options
ajaxBackbone.ajax = function(request) { ... };It defines the custom ajax function.
emulateHTTPBackbone.emulateHTTP = trueIf your web server does not support REST or HTTP approach, then turn on the Backbone.emulateHTTP.
emulateJSONBackbone.emulateJSON = trueIt is used to handle the requests encoded with application/json by setting the method to true.

Leave a Reply

Your email address will not be published. Required fields are marked *