title: Ajax - Check for database update
body: <p>Im making a autobuy system. I have a invoice page that  show with default - payment processing. I have made it so that when they actually buy via coinpayments.net, it updates the database to status 1. I want to make it so that when the status changes to 1 in the database, it updates the invoice page without refreshing and says "Payment Status: Completed". I have some ajax and php code but it doesn't seem to be working. I update the database status to 1 and no text changes on my page.  I have a timer interval that should be updating every 2 seconds but something is wrong. Please help.</p>
  
  <p><strong><em>My HTML status code</em></strong></p>
  
  <pre><code>&lt;input type="hidden" id="order_numb" value="&lt;?php echo $_SESSION['succ_itm_id']; ?&gt;"&gt;
  
  &lt;div id="payment" style="text-align: center;"&gt;
      Status&lt;br&gt;&lt;img src="../img/processing/payment_proc.gif"&gt;&lt;br&gt;Payment Pending
  &lt;/div&gt;
  </code></pre>
  
  <p><strong><em>My AJAX code</em></strong></p>
  
  <pre><code>&lt;script&gt;
  function send_data() {
      var order_id = $('#order_numb').val();
      $.ajax ({
          type: "POST",
          url: '../rld_payment.php',
          data: { order_num: order_id },
          success:function(data)
          {
              $('#payment').innerHTML = 'Status&lt;br&gt;&lt;b&gt;Payment Completed!&lt;/b&gt;&lt;br&gt;&lt;b&gt;Redirecting&lt;/b&gt; ...';
          }
      });
  }
  
  send_data();
  setInterval(send_data, (2 * 1000));
  &lt;/script&gt;
  </code></pre>
  
  <p><strong><em>My PHP code to check status</em></strong></p>
  
  <pre><code>&lt;?php
  include('conf/db_.php');
  
  $order_id       =   mysqli_real_escape_string($con, $_POST['order_num']);
  $order_status   =   mysqli_query($con, "SELECT `status` FROM `orderinfo` WHERE `order_id` = '$order_id'") or die(mysqli_error($con));
  if($order_status == 1)
  {
      echo 'Status&lt;br&gt;&lt;b&gt;Payment Completed!&lt;/b&gt;&lt;br&gt;&lt;b&gt;Redirecting&lt;/b&gt; ...';
      return true;
  }
  
  ?&gt;
  </code></pre>