title: Ajax call not working when navigating back to previous page
body: <p>I have a page in php where i m loading some div s on scrolling to bottom with ajax call
  But when i click on any div to go to next page and when i come back from navigated page,my ajax scrolling which is loading content on to bottom of windows does not work.
  Below is my code</p>
  
  <pre><code>&lt;?php
      $mysqli = new mysqli('localhost', 'root', '', 'table1');
  
     if(mysqli_connect_errno()) {
        echo "Connection Failed: " . mysqli_connect_errno();
        }
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Language" content="en-us"&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1252"&gt;
  &lt;title&gt;Load data after page scroll &lt;/title&gt;
  &lt;script type='text/javascript' src='js/jquery-1.7.2.min.js'&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="css/style.css" type="text/css" /&gt;
  
  &lt;script type="text/javascript" language="javascript"&gt; 
  
  $(document).ready(function(){
  
  $(window).scroll(function(){
      scrollMore();
  });
  
  function scrollMore(){
      if($(window).scrollTop() == ($(document).height() - $(window).height())){
  
      var offset = $('[id^="myData_"]').length; // here we find out total records on page.
      var records = $(".allData").text();
  
      $(window).unbind("scroll");
          if(records != offset){
              $("#loaderImg").html('&lt;img src="images/ajax-loader.gif" /&gt;');
              $("#loaderImg").show();
              loadMoreData(offset);
          }
      }
  }
  
  function loadMoreData(offset){
      $.ajax({
          type: 'get',
          async:false,
          url: 'getMoreData.php',
          data: 'offset='+offset,
          success: function(data){
          console.log(data);
              $("#loaderImg").empty();
              $("#loaderImg").hide();
              $(".loadData :last").after(data);
          },
          error: function(data){
              alert("ajax error occured…"+data);
          }
      }).done(function(){
          $(window).bind("scroll",function(){
          scrollMore();   
      });
      });
  }
  
  
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;?php
      $sql ="select * from xml";
      $countsql3 = mysqli_query($mysqli, $sql) or die("Cannot Get Pname Info: (".mysql_error().")");
      $numrows = mysqli_num_rows($countsql3);
  
      $limit = 20;
      $offset = 0;
      $mysql = "select * from xml limit ".$offset.", ".$limit."";
      $countsql3 = mysqli_query($mysqli, $mysql) or die("Cannot Get Pname Info: (".mysql_error().")");
  
  
  ?&gt;
  
  &lt;div class="totalData"&gt;Total Records Found:&lt;span class="allData"&gt;&lt;?php echo $numrows;?&gt;&lt;/span&gt;&lt;/div&gt;
  
  &lt;div class="mainDiv"&gt;
  &lt;div class="tableRow"&gt;
  &lt;div class="firstColumn"&gt;&lt;strong&gt;#&lt;/strong&gt;&lt;/div&gt;
  &lt;div class="secondColumn"&gt;&lt;strong&gt;Record&lt;/strong&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;?php
  $i = 1;
  while($result = mysqli_fetch_array($countsql3)){ ?&gt;
  &lt;div class="tableRow loadData" id="myData_&lt;?php echo $i;?&gt;"&gt;
  &lt;div class="firstColumn"&gt;&lt;a href="nextpage.php"&gt;&lt;?php echo $result['PID']; ?&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;div class="secondColumn"&gt;&lt;?php echo $result['PID']?&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;?php $i++; }?&gt;
  &lt;div class="tableRow"&gt;
  &lt;div class="secondColumn" id="loaderImg" style="display:none;"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>getMoreData.php</p>
  
  <pre><code>&lt;?php
  $mysqli = new mysqli('localhost', 'root', '', 'table1');
  
     if(mysqli_connect_errno()) {
        echo "Connection Failed: " . mysqli_connect_errno();
        }
  
  $offset = (isset($_REQUEST['offset']) &amp;&amp; $_REQUEST['offset']!='') ? $_REQUEST['offset'] : '';
  $limit = 10;
  $qry1 ="select * from xml limit ".$offset.", ".$limit."";
  $countsql3 = mysqli_query($mysqli, $qry1) or die("Cannot Get Pname Info: (".mysql_error().")");
  $i = ++$offset;
  while($result = mysqli_fetch_array($countsql3)){ ?&gt;
  &lt;div class="tableRow loadData" id="myData_&lt;?php echo $i;?&gt;"&gt;
  &lt;div class="firstColumn"&gt;&lt;a href="nextpage.php"&gt;&lt;?php echo $result['PID']; ?&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;div class="secondColumn"&gt;&lt;?php echo $result['PID']?&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;?php $i++; } ?&gt;
  </code></pre>
  
  <p>nextpage.php</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
  hi 
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Please look at code and guide me for solution</p>