title: Backbone.js error - Uncaught TypeError: Object [object Object] has no method 'set'
body: <p>My Code:</p>
  
  <p>I am new to Backbone.js and trying to build an app with Backbone.js and PHP. When I am trying to call <code>add</code> in the router, I am getting error:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Object [object Object] has no method 'set'. </p>
  </blockquote>
  
  <p>Please help me to find my mistake.</p>
  
  <p>Thanks.</p>
  
  <pre><code>    // Models
      window.Users = Backbone.Model.extend({
          urlRoot:"./bb-api/users",
          defaults:{
              "id":null,
              "name":"",
              "email":"",
              "designation":""
          }
      });
  
      window.UsersCollection = Backbone.Collection.extend({
          model:Users,
          url:"./bb-api/users"
      });
  
  
      // Views
  
  
      window.AddUserView = Backbone.View.extend({
  
          template:_.template($('#new-user-tpl').html()),
  
          initialize:function(){
              this.model.bind("click", this.render, this);
          },
  
          render:function(){
              $(this.el).html(this.template(this.model.toJSON()));
              return this;
          },
  
          events:{
              "click .add":"saveUser"
          },
  
          saveUser:function(){ alert('saveUser');
              this.model.set({
                  name:$("#name").val(),
                  email:$("#email").val(),
                  designation:$("#designation").val()
              });
  
              if(this.model.isNew()){
                  this.model.create(this.model);
              }
              return false;
          }
      });
  
  
      // Router
      var AppRouter = Backbone.Router.extend({
  
          routes:{
              "":"welcome",
              "users":"list",
              "users/:id":"userDetails",
              "add":"addUser"
          },
  
  
          addUser:function(){ 
              this.addUserModel = new UsersCollection();
              this.addUserView = new AddUserView({model:this.addUserModel});
              $('#content').html(this.addUserView.render().el);
          }
  
  
      });
  
      var app = new AppRouter();
      Backbone.history.start();
  </code></pre>