title: How to send GET value and php available to another page using ajax?
body: <p>First i access to </p>
  
  <pre><code>www.mysite.com/index.php?order_by=id asc
  </code></pre>
  
  <p>i want to sent <code>$name</code> AND <code>$_GET[order_by]</code> to <code>autoload_process.php</code> , How can i do ?</p>
  
  <p>.</p>
  
  <p>.</p>
  
  <p>.</p>
  
  <p>index.php</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Auto Loading Records&lt;/title&gt;
  &lt;script type="text/javascript" src="js/jquery-1.9.0.min.js"&gt;&lt;/script&gt;
  
  &lt;?php
  include("connect.php");
  $items_per_group = 5;
  $mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASSWORD, $DB_NAME);
  
  $results = $mysqli-&gt;query("SELECT COUNT(*) as t_records FROM product_details");
  $total_records = $results-&gt;fetch_object();
  $total_groups = ceil($total_records-&gt;t_records/$items_per_group);
  $results-&gt;close(); 
  ?&gt;
  
  &lt;script type="text/javascript"&gt;
  $(document).ready(function() {
      var track_load = 0; //total loaded record group(s)
      var loading  = false; //to prevents multipal ajax loads
      var total_groups = &lt;?php echo $total_groups; ?&gt;; //total record group(s)
  
      $('#results').load("autoload_process.php", {'group_no':track_load}, function() {track_load++;}); //load first group
  
      $(window).scroll(function() { //detect page scroll
  
          if($(window).scrollTop() + $(window).height() == $(document).height())  //user scrolled to bottom of the page?
          {
  
              if(track_load &lt;= total_groups &amp;&amp; loading==false) //there's more data to load
              {
                  loading = true; //prevent further ajax loading
                  $('.animation_image').show(); //show loading image
  
                  //load data from the server using a HTTP POST request
                  $.post('autoload_process.php',{'group_no': track_load}, function(data){
  
                      $("#results").append(data); //append received data into the element
  
                      //hide loading image
                      $('.animation_image').hide(); //hide loading image once data is received
  
                      track_load++; //loaded group increment
                      loading = false; 
  
                  }).fail(function(xhr, ajaxOptions, thrownError) { //any errors?
  
                      alert(thrownError); //alert with HTTP error
                      $('.animation_image').hide(); //hide loading image
                      loading = false;
  
                  });
  
              }
          }
      });
  });
  &lt;/script&gt;
  &lt;style&gt;
  body,td,th {font-family: Georgia, Times New Roman, Times, serif;font-size: 15px;}
  .animation_image {background: #F9FFFF;border: 1px solid #E1FFFF;padding: 10px;width: 500px;margin-right: auto;margin-left: auto;}
  #results{width: 500px;margin-right: auto;margin-left: auto;}
  #resultst ol{margin: 0px;padding: 0px;}
  #results li{margin-top: 20px;border-top: 1px dotted #E1FFFF;padding-top: 20px;}
  &lt;/style&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;ol id="results"&gt;
  &lt;/ol&gt;
  &lt;div class="animation_image" style="display:none" align="center"&gt;&lt;img src="ajax-loader2.gif"&gt;&lt;/div&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>autoload_process.php</p>
  
  <pre><code>&lt;?php
  include("connect.php");
  $items_per_group = 5;
  $mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASSWORD, $DB_NAME);
  
  if($_POST)
  {
      //sanitize post value
      $group_number = filter_var($_POST["group_no"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);
  
      //throw HTTP error if group number is not valid
      if(!is_numeric($group_number)){
          header('HTTP/1.1 500 Invalid number!');
          exit();
      }
  
      //get current starting point of records
      $position = ($group_number * $items_per_group);
  
      //Limit our results within a specified range. 
      $results = $mysqli-&gt;query("SELECT * FROM product_details WHERE seller = '$name' ORDER BY $_GET[order_by] LIMIT $position, $items_per_group");
  
      if ($results) { 
          //output results from database
  
          while($obj = $results-&gt;fetch_object())
          {
              echo '&lt;li id="item_'.$obj-&gt;id.'"&gt;'.$obj-&gt;id.' - &lt;strong&gt;'.$obj-&gt;seller.'&lt;/strong&gt;&lt;/span&gt; &amp;mdash; &lt;span class="page_message"&gt;'.$obj-&gt;description.'&lt;/span&gt;&lt;/li&gt;';
          }
  
      }
      unset($obj);
      $mysqli-&gt;close();
  }
  ?&gt;
  </code></pre>