title: Jquery submit and post to post a form unable to return data
body: <p>i have problem with jquery submit and post. I would like to submit a form and post it to my php for a check, and return the php result back to the form. However, I have problem with the returning of data, it basically ignores the result.</p>
  
  <p>This is my html form:</p>
  
  <pre><code>&lt;form id="form" method="post"&gt;
      &lt;p id="status"&gt;Status:&lt;/p&gt;
      &lt;p class="text"&gt;
          &lt;label for="name" class="label"&gt;Name:&lt;/label&gt;
          &lt;input type="text" id="name" name="name" value="" size="30" /&gt;
      &lt;/p&gt;
      &lt;p class="text"&gt;
          &lt;label for="email" class="label"&gt;Email:&lt;/label&gt;
          &lt;input type="text" id="email" name="email" value="" size="30" /&gt;
      &lt;/p&gt;
      &lt;p class="submit"&gt;
          &lt;input type="submit" name="send_btn" id="send_btn" value="Send" /&gt;
      &lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>This is my javascript to do the submit and post:</p>
  
  <pre><code>$('#form').submit(function(e) {
      e.preventDefault();
  
          var name = $('#name').val();
          var email = $('#email').val();
  
          $.post('notify.php', {name: name, email: email}, function(data) {
              $('#status').html(data);
          });
  
  });
  </code></pre>
  
  <p>This is the php that does the check and return the data:</p>
  
  <pre><code>&lt;?php 
  if (isset($_POST['name'], $_POST['email']))
  {
      $name = htmlentities($_POST['name']);
      $email = htmlentities($_POST['email']);
  
      if ($name == "myname")
      {
          $output = 'It matches!';
      }
      else
      {
          $output = 'No matches!";
      }
  }
  ?&gt;
  </code></pre>
  
  <p>Can please highlight what has gone wrong? Thank you.</p>