Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Backbone Save Example

    var details = new Backbone.Model({  
            name: "My name",  
            site: "My site"  
         });  
  
         Backbone.sync = function(method, model) {  
            document.write(method + ": " + model.get('name')+ " " +model.get('site'));  
            model.set('id', 1);  
         };  
         details.save();  
         document.write("<br>");  
         details.save({name : "I repeat"});  
document.write("<br>");
details.fetch();
/*difference with fetch() is the method is different*/
 
PREVIOUS NEXT
Tagged: #Backbone #Save #Example
ADD COMMENT
Topic
Name
1+7 =