The Problem of Front-end js Pull-up Refresh Obtaining Data

  node.js, question

The first time I pulled up, I triggered ajax to load data. If I pulled up again the second time, wouldn’t I load it again? If paging is used, how do I judge which page to pull up and update?

I may not have expressed it very well. If I don’t understand what I can say, I’d better put in the source code for implementation. Thank you all first.

$( function(){
          var i=1;
         $(window).scroll( function(){
                  var scrollTop = 0;
                  var clientHeight = 0;
                  var scrollHeight = 0;
                  var replaceAppNo=$("input[name='replaceAppNo']" ).val();
                  if (document.documentElement && document.documentElement.scrollTop) {
                      scrollTop = document.documentElement.scrollTop;
                  } else if (document.body) {
                      scrollTop = document.body.scrollTop;
                  if (document.body.clientHeight && document.documentElement.clientHeight) {
                      clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight: document.documentElement.clientHeight;
                  } else {
                      clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight: document.documentElement.clientHeight;
                  scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
                  if (scrollTop 加 clientHeight == scrollHeight) {           
                      $.getJSON("*****Action_getAjaxList.action" ,{page:i,replace_App_No:replaceAppNo},function(json){                
                            $.each(json, function(n,value){
                                    var trs = "" ;
                                   trs 加= "<tr><td align='center'><input type='checkbox'></td><td align='center'>"加(value.quaNo== undefined?'' :value.quaNo)加"</td><td align='center'>"加(value.chaVin== undefined?'' :value.chaVin)加"</td><td align='center'>"加(value.prdModelNo== undefined?'' :value.prdModelNo)加"</td><td width='10百分比' align='right'>"加value.quaMone加 "</td><td align='center'>"加(value.facDate== undefined?'' :value.facDate)加"</td><td align='center'>"加(value.accDate== undefined?'' :value.accDate)加"</td><td width='6百分比' align='center'>"加(value.cerType== undefined?'' :value.cerType)加"</td><td align='center'>"加(value.brandNo== undefined?'' :value.brandNo)加"</td></tr>";
                                   $( "#tablist tr:last" ).after(trs);

I handled it by defining global I