title: Passing Variables OnLoad using PHP $_GET[''] With Ajax
body: <p>So I have an HTML, PHP and ajax application that is loading this page:
  ViewOrderReports.php?order_number=77409362. I am trying to pass the order_number 
  to report_action.php on load.</p>
  
  <p>On ViewOrderReports.php?order_number=77409362 page I have the code below to get the 
  order number:</p>
  
  <pre><code>&lt;?Php
    if(isset($_GET["order_number"]))
    {
         $order_number=addslashes(strip_tags($_GET["order_number"]));
         echo $order_number;
    }
  ?&gt;
  &lt;div id="order_number" style="display: none;" value="&lt;?php echo $order_number; ?&gt;"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Then on the ajax javascript part in the page I have this code :</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
    $(document).ready(function(){
  
    load_data();
  
    $('#action').val("Insert");
  
    function load_data(page)
   {
         var action = "Load";
         var order_number = $("#order_number").val();
  
    $.ajax({
      url:"phptables/report_action.php",
       method:"POST",
      data:{action:action, order_number:order_number, page:page},
      success:function(data)
    {
     $('#order_table').html(data);
    alert('Current Order Number' + order_number);
    }
     });
    }
  
   &lt;/script&gt;
  </code></pre>
  
  <p>Lastly, the PHP receiving the order number is below.</p>
  
  <pre><code>&lt;?Php
  
    if(isset($_POST["action"]) == "Load"&amp;&amp;isset($_POST["order_number"]))
    {
  
        echo "Do my actions";  
  
    }
  ?&gt;
  </code></pre>
  
  <p>The problem is the order number is no been passed to the receiving PHP. I tried debugging on the
  ajax code on the sending page but seems as if the $_GET and div part is not completed loaded before the ajax onload runs on ViewOrderReports.php?order_number=77409362. Hope you can help.</p>