There are the following points:
1. The Sync method stores the model persistently on the server side. You can rewrite the implementation method of this method, which uses jquery's $. Ajax by default.
2. For the entire backbone, only the sync of the model and collection will call backbone. Sync.
3. The request type is determined by the first parameter method, which can be create/update/patch/delete/read. It uses restful requests by default.
4. the requested data is determined by the second parameter model. The URL is the URL of the model by default, and the data is the attributes of the model to be converted to JSON. The default data type is JSON.
5. After a request, the model request event is triggered. If the handler of the event is added.
Execution Process
1 process type, from methodmap
2. initialize options.
3. initialize Params, including type, datatype, and URL.
4 during create/update/patch, the contenttype of Params is application/JSON, and Params. Data must have a value. The value of "model" is converted to "JSON ".
5 emulatejson
6 mimicking HTTP
7. processdata is false for non-GET requests.
8. Rewrite xhr in earlier ie versions during patch
9 trigger a request event
Diagram
Related:
Http://www.ruanyifeng.com/blog/2011/09/restful.html