title: Send the value input type text to another php file using ajax
body: <p>I'm trying to send the value of this</p>
  
  <pre><code>&lt;form class="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="POST"&gt;
        &lt;input type="hidden" name="business" value="nineteenseventees@gmail.com"&gt;
        &lt;input type="hidden" name="cmd" value="_xclick"&gt;
        &lt;input type="hidden" name="upload" value="1"&gt;
        &lt;input type="hidden" name="item_name" value="'.$fetch['ShirtType'].'-'.$fetch['ShirtSize'].'-'.$fetch['ShirtColor'].'"&gt;
        &lt;input type="hidden" name="item_number" value="'.$fetch['itemnum'].'"&gt;
        &lt;input type="hidden" name="quantity" value="'.$fetch['quantity'].'"&gt;
        &lt;input type="hidden" name="amount" value="'.$fetch['ItemPrice'].'"&gt;
        &lt;input type="hidden" name="currency_code" value="PHP"&gt;
        &lt;input type="hidden" name="cancel_return" value="http://localhost/imageupload/index.php"&gt;
        &lt;input type="hidden" name="return" value="http://localhost/imageupload/paysuccess.php"&gt;
        &lt;input type="hidden" id="ordernumber" value="'.$fetch['OrderNum'].'"&gt;
        &lt;button class="btn btn-primary pull-right" type="submit" id="paypalbutton" name="paypalbutton"&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt;&lt;/button&gt;
  </code></pre>
  
  <p></p>
  
  <p>When I press the button, this go to paypal. But I want it to go to paypal via ajax and also save the OrderNum to session.</p>
  
  <p>I tried using AJAX but i can't seem to make it work. here it is</p>
  
  <pre><code>  $('#paypalbutton').on('click', function(e){
    var num = $("#ordernumber").val();
    $.ajax({
      type: 'POST',
      url: 'redirect.php',
      data: {
          onumber: num
      }
   }); 
  });
  </code></pre>
  
  <p>I'm trying to send it here: <strong>redirect.php</strong></p>
  
  <pre><code>&lt;?php
  session_start();
  require_once 'dbconnect.php';
  
  $_SESSION['order'] = $_POST['onumber'];
  echo $_SESSION['order'];
  
  ?&gt;
  </code></pre>