title: jQuery ajax form doesn't work
body: <p>I tried many ways to create a simple jquery ajax form but don't know why it is not submitting and/or returning the notification.</p>
  
  <p>Here is my code:</p>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>...
  &lt;script type="text/javascript" src="assets/js/jquery1.11/jquery-1.11.0.min.js"&gt;&lt;/script&gt;
  ...
  
  $('#form_signup').submit(function(event) {
      event.preventDefault();
      $.ajax({
          type: 'POST',
          url: 'signup.php',
          data: $(this).serialize(),
          dataType: 'json',
          success: function (data) {
              console.log(data);
              $('#form_signup_text').html(data.msg);
          },
          error: function (data) {
              console.log(data);
              $('#form_signup_text').html(data.msg);
          }
      });
  });
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;form id="form_signup" name="form_signup" method="POST"&gt;
      &lt;div&gt;
          &lt;input type="email" id="inputEmail1" name="inputEmail1" placeholder="your@email.com"&gt;
      &lt;/div&gt;
      &lt;div&gt;
          &lt;a type="submit"&gt;Sign up!&lt;/a&gt;
      &lt;/div&gt;
      &lt;div id="form_signup_text"&gt;
          &lt;!-- A fantastic notice will be placed here =D --&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>&lt;?php
  
  $our_mail =    "our@email.com";
  $subject  =    "Wohoo! A new signup!";
  $email    =    $_POST['inputEmail1'];
  
  $return = array();
  $return['msg'] = 'Thank you!';
  $return['error'] = false;
  
  if(preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)){
  
      $message = "Yesss!! We receive a new signup!
      E-mail: $email
      ";
      mail($our_mail, $subject, $message);
  
  }
  else {
      $return['error'] = true;
      $return['msg'] .= 'Something is wrong... snifff...';
  }
  
  return json_encode($return);
  </code></pre>
  
  <hr>
  
  <p><strong>Solved:</strong></p>
  
  <p>There were three problems. And different users solve each of these problems.</p>
  
  <ol>
  <li>In PHP, you must "echo" the return array instead of "return"</li>
  <li>At first, you should use a submit button instead of an anchor in the form</li>
  <li>In the input, you must set both "id" and "name"</li>
  </ol>
  
  <p>If any of these users want, you can edit or add a new answer with these details, and the points are yours.</p>