|
The Backbone.js sync Collection is the function that the collection calls every time attempts to request the server. When a collection begins a sync with the server, a request event is emitted. If the request completes successfully you’ll get a sync event and an error event if not. Syntax: collection.sync( method, model, options ); Parameters: It takes three parameters that are discussed below:
Example 1: In this example, we will illustrate the Backbone.js sync Collection. Here we will fetch the data which will eventually call the sync function of collection. HTML
Output: Backbone.js sync collection Example 2: In this example, we will make the user define save function to the collection which will sync with the server, and on success, it will print a success message and on error, it will print an error message. HTML
Output: Backbone.js sync Collection Reference: https://backbonejs.org/#Collection-sync |
Reffered: https://www.geeksforgeeks.org
JavaScript |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |