title: Send single input with ajax/jquery/php
body: <p>I'm new to jQuery / AJAX.
  I'm trying to send single input with jquery/ajax/php.</p>
  
  <p><strong><a href="http://webiq.co/SingleInput/" rel="nofollow">LIVE EXAMPLE</a></strong></p>
  
  <p><strong>But, after pressing submit nothing is happening, where is my error?
  Any help much appreciated.</strong></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form action="submit.php"&gt;
      &lt;input id="number" name="number" type="text" /&gt;
      &lt;input id="submit" name="submit" type="submit" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>JQUERY / AJAX:</p>
  
  <pre><code>$(document).ready(function(e) {
      $('input#submit').click(function() {
          var number = $('input[name=number]');
          var data = 'number=' + number.val();
  
          $.ajax({
              url: "submit.php",
              type: "GET",
              data: data,
              cache: false,
              success: function(html) {
                  if (html == 1) {
                      alert('wyslane');
                  }
                  else {
                      alert('error');
                  }
              }
          });
          return false;
      });
  });
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php 
      $mailTo = 'email@gmail.com';
      $mailFrom = 'email@gmail.com';
      $subject = 'Call Back';
      $number = ($_GET['number']) ? $_GET['number'] : $_POST['number'];   
      mail($mailTo, $subject, $number, "From: ".$mailFrom);
  ?&gt;
  </code></pre>