title: AJAX response returns html content
body: <p>I have an AJAX call in my codeigniter project. Here is my code:</p>
  
  <p>in view :</p>
  
  <pre><code>$('#forgotPassword').click(function() {
          var base_url = '&lt;?php echo base_url()?&gt;'; 
          $('#forgotPasswordEmailError').text('');
          var email = $('#forgotPasswordEmail').val(); 
          console.log(email);
          if(email == ''){
              $('#forgotPasswordEmailError').text('Email is required');
          }else{
              $.ajax({
                  url : base_url + 'Home/forgotPassword',
                  type : 'POST',
                  data : {email : email},
                  success: function(data) {       
                      console.log(data);                  
                      //location.reload();
                  }
              });
          }
  
      });
  </code></pre>
  
  <p>and controller :</p>
  
  <pre><code>public function forgotPassword() { 
     $email = $this-&gt;input-&gt;post('email');
     echo $email; 
  }
  </code></pre>
  
  <p>but the response contains only the html content from my view. I couldn't identify what is happening. </p>