title: how to get data using ajax in pagination?
body: <p>I want to get 3 data from a page using ajax get method.</p>
  
  <p>The javascript is</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    var busy = false;
    var limit = 15
    var offset = 0;
    var id = 150;
  
    function displayRecords(lim, off) {
      $.ajax({
        type: "GET",
        async: false,
        url: "s.php",
        data: "limit=" + lim + "&amp;offset=" + off,
        cache: false,
        beforeSend: function() {
          $("#loader_message").html("").hide();
          $('#loader_image').show();
        },
        success: function(html) {
          $("#results").append(html);
          $('#loader_image').hide();
          if (html == "") {
            $("#loader_message").html('&lt;button class="btn btn-default"    type="button"&gt;No more records.&lt;/button&gt;').show()
          } else {
            $("#loader_message").html('&lt;button class="btn btn-default"  type="button"&gt;Loading please wait...&lt;/button&gt;').show();
          }
          window.busy = false;
  
  
        }
      });
    }
  
    $(document).ready(function() {
      // start to load the first set of data
      if (busy == false) {
        busy = true;
        // start to load the first set of data
        displayRecords(limit, offset);
      }
  
      $(window).scroll(function() {
        // make sure u give the container id of the data to be loaded in.
        if ($(window).scrollTop() + $(window).height() &gt;  $("#results").height() &amp;&amp; !busy) {
           busy = true;
          offset = limit + offset;
          // this is optional just to delay the loading of data
          setTimeout(function() { displayRecords(limit, offset); }, 500);
          // you can remove the above code and can use directly this function
          // displayRecords(limit, offset);
        }
      });
  
    });
  
   &lt;/script&gt;
  </code></pre>
  
  <p>and s.php is</p>
  
  <pre><code>$limit = (intval($_GET['limit']) != 0 ) ? $_GET['limit'] : 10;
  $offset = (intval($_GET['offset']) != 0 ) ? $_GET['offset'] : 0;
  $id = $_GET['id'];
  echo $id;
  </code></pre>
  
  <p>but i can't get the value of id, each time i'm trying new way something went wrong or it shows error, the php file doesnot get the id value using ajax. but it 'll gets the values of limit and offset perfectly. both limits and offsets are not a constant values but the id is constant one.</p>
  
  <p>How can I fix this..?</p>