Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Backbone Sync And Fetch

        Backbone.sync = function(method, model) {  
           document.write("The state of the model is:");  
           document.write("<br>");  
  
           //The 'method' specifies state of the model  
           document.write(method + ": " + JSON.stringify(model));  
        };  
  
        //The 'myval' is collection instance and contains the values which are to be fetched in the collection  
        var songs = new Backbone.Collection({  
           name:"Song One",  

        });  
  
        //The myval.fetch() method display the model's state by delegating the sync() method  
        songs.fetch();  
 
PREVIOUS NEXT
Tagged: #Backbone #Sync #And #Fetch
ADD COMMENT
Topic
Name
1+9 =