title: Why am i encountering an Uncaught ReferenceError in Jquery?
body: <p>Iam creating a js function that will switch the content of the body of my page as follows:</p>
  
  <pre><code> var BodySwitcher = {
  
          initBodySwitcher : function(){
              var self = this;
              $(document).on("click", ".bodySwitcher", function() { 
                  var action = $(this).attr("id");
                  self.ajaxCall(action, null, $.proxy(self.showBody, this), $.proxy(self.initCall, this));
              });
          },
  
          ajaxCall : function(action, data, callback, callback1){
              $.ajax({
                  url: action,
                  type: "POST",
                  data: data,
                  error: function(){
                      alert('Please Contact your Administrator');
                  },
                  success: function(data){         
                      callback(data);
                  },
                  complete: function (data){
                      callback1(data);
                  }
              });
          },
  
          showBody : function(data){
              var $container = $("#body_container");
              $container.empty();
              $container.html(data);
          },
  
          initCall: function(data){
              var $container = $("#body_container");
              var $table = $container.find(".table");
              if ($table.length &gt; 0){ 
                  initDataTable($table);
              }
              var $form = $container.find("form");
              if ($form.length &gt; 0){ 
                  initForm($form);
              }
  
          },
  
          initDataTable : function($table){
              if ($table.length &gt; 0){ 
                  $("#"+$table.attr("id")).dataTable( {
                      "sPaginationType": "full_numbers"
                  } );
              }
          },
  
          initForm: function($form){
              alert("form");
              var self = this;
              $form.form.validate();
              $formSubmit = $form.find(".button");
              $(document).on("click", $formSubmit, function(){
                  var formData = $form.serialize();
                  var action = $form.attr("id");
                  alert(action);
                  self.ajaxCall(action, formData, $.proxy(self.showBody, this), $.proxy(self.initCall, this));
              });
          }
  
      };
  </code></pre>
  
  <p>But Iam encountering this error:</p>
  
  <pre><code>Uncaught ReferenceError: initForm is not defined 
  </code></pre>
  
  <p>why? How come it can find the initDataTable  but not the initForm?</p>