title: storing html(response) in var
body: <p>Im using ajax to send a form without reloading. I use the following method for this:</p>
  
  <p>My mail sender:</p>
  
  <pre><code>if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
      mailTo($to, $subject, $message, $headers); 
      echo "0";
  }else{
      echo "1";
  }
  </code></pre>
  
  <p>The script that sends the info to the php file above</p>
  
  <pre><code>$(document).ready(function(){
      $('#submitbtn').click(function(){
          $.post("send.php", $("#mycontactform").serialize(),  function(response) {   
              $('#success').html(response);
          });
          return false;
      });
  });
  </code></pre>
  
  <p>Whenever I give a valid email and its send it returns <code>0</code>. when it fails it returns <code>1</code>. Now instead of displaying this value in the div #SUCCESS I want to store this value in a var so I can see if the mail is send or not. and if send can hide the contact form.</p>
  
  <p>I came up with this:</p>
  
  <pre><code>$(document).ready(function(){
      $('#submitbtn').click(function(){
          $.post("send.php", $("#mycontactform").serialize(),  function(response) {   
              var x = html(response);
              if (x == 0){
              $('#mycontactform.hide').hide;
                  document.getElementByID('succes').innerHTML = 'Message send';
              }else{
                  //display some error message
              }
          });
          return false;
      });
  });
  </code></pre>
  
  <p>But its not working. anyone know why. I assume it has something to do with <code>var x =</code> is not storing Html response</p>