title: Cannot read property 'success' of null
body: <p>I have the following javascript function</p>
  
  <pre><code>$("#formLogin").submit(function(e){     
         e.preventDefault();
  
          var memberUserName = $(this).find("#memberUserName").val();
          var memberOldPassword = $(this).find("#memberOldPassword").val();
          alert(memberUserName);
          alert(memberOldPassword);
          var obj = {memberUserName: memberUserName, memberOldPassword: memberOldPassword};
          var url = $(this).attr("action");
          $.post(url, obj, function(r){
  
              if(r.success) window.location.replace('http://www.example.org/memberAccount/memberDashboard');
  
              else  $('#errorMessageTop').fadeIn();
  
          }, 'json')
     })
  </code></pre>
  
  <p>When I alert, memberOldPassword i get undefined. In my form, i have the filed, here is the code:</p>
  
  <pre><code>&lt;input type="password" class="good_input" id="memberOldPassword" name="memberOldPassword" style="float:right;width:135px;"/&gt;&lt;br /&gt;
  </code></pre>
  
  <p>Here is the PHP code of my controller:</p>
  
  <pre><code> public function loginCheck()
      {     
          // set the validation rules
          $this-&gt;form_validation-&gt;set_rules('memberUserName', 'Username', 'required|trim|encode_php_tags');
          $this-&gt;form_validation-&gt;set_rules('memberOldPassword', 'Password', 'required|trim|encode_php_tags');
          $this-&gt;form_validation-&gt;set_error_delimiters('&lt;br /&gt;&lt;p class=jsdiserr&gt;', '&lt;/p&gt;&lt;br /&gt;');
          // if validation is passed
  
          if ($this-&gt;form_validation-&gt;run() != FALSE) 
          {
  
  
              $this-&gt;db-&gt;where('memberUserName', $this-&gt;input-&gt;post('memberUserName'));
              $this-&gt;db-&gt;where('memberOldPassword', strtoupper(md5("EBOSS/".$this-&gt;input-&gt;post('memberOldPassword')."/EBOSS")));
              $query = $this-&gt;membersModel-&gt;get();
              if($query)
              {
  
                  $data = array(
                      'memberID'                      =&gt; $query[0]['memberID'],
                      'memberUserName'                =&gt; $query[0]['memberUserName'],
                      'memberOldPassword'             =&gt; $query[0]['memberOldPassword'],
                      'memberEmail'                   =&gt; $query[0]['memberEmail'],
                      'isUserLoggedIn' =&gt; TRUE
                  );           
                  $members = $query-&gt;result_array();            
                  $this-&gt;session-&gt;set_userdata('currentMember',$data);
  
                  echo json_encode(array("success" =&gt; true));
          } else {   
                  echo json_encode(array("success" =&gt; false, "error" =&gt; "Wrong credentials"));
          }
          //  form validation has failed 
          } else {     
              $errorMessage = "Wrong Username or passwrod!";
          }
      }   // end of function loginCheck 
  </code></pre>
  
  <p>I use jQuery v1.7.2, and PHP version is 5.39</p>
  
  <p>Anyone has an idea why do I get undefined when I alter the password?</p>