In Show more on click show more button script like this-works

<script>
$(document).ready(function()
{
   $(document).on("click", "._SP12_SHOWMORE", function()
   {
     var SMJX_SRCH_DPERPG = 5;
     var SMJX_SMR_SUC = $("._SP12_SHOWMORE").attr('data-srch-uc');                
     var SMJX_SMR_LST_CNT = $("._SP12_SHOWMORE").attr('data-lstcnt');
     var SMJX_SRCH_ON = $("._SP12_SHOWMORE").attr('data-srch-on');
     var SMJXRET_GTLST = false;
     var SMJXRET_GTGRD = false;
     var SMJXRET_GTLSTDT = "";
     var SMJXRET_GTGRDDT = "";
     var datastring = {'DSUC':SMJX_SMR_SUC,'SRCON':SMJX_SRCH_ON, 'LCNT':SMJX_SMR_LST_CNT,};

     $.ajax({
        url:'<?php echo base_url()."search-ax-shwmre-rd";?>',
        type: 'POST',
        data: datastring,
        success:function(rtb)
        {            
          SMJXRET_GTGRD = true;
          SMJXRET_GTGRDDT = rtb;

          $.ajax({
           url:'<?php echo base_url()."search-ax-shwmre-st";?>',
           type: 'POST',
           data: datastring,
           success:function(rt)
           {
               SMJXRET_GTLST = true;  
               SMJXRET_GTLSTDT = rt;
               var SMJX_NXTDATA_COUNT = Number(SMJX_SMR_LST_CNT) + Number(SMJX_SRCH_DPERPG);
               var SMJX_RET_SHOWMORE_SPANBXX = "<span class='_SP12_SHOWMORE _SHM18-SHWMR2-MR11' id='SHM185-MOREAFTR' data-lstcnt='"+SMJX_NXTDATA_COUNT+"' data-srch-uc='"+SMJX_SMR_SUC+"' data-srch-on='"+SMJX_SRCH_ON+"'>SHOW MORE</span>";
     var SMJX_RET_NOMORE_SPANBXX = "<span class='_SP12_NOMORE _SHM18-SHWMR2-MR11' id='SHM185-MOREAFTR' data-lstcnt='"+SMJX_NXTDATA_COUNT+"' data-srch-uc='"+SMJX_SMR_SUC+"' data-srch-on='"+SMJX_SRCH_ON+"'>NO MORE DATA</span>";

   var SMJX_SRCH_SHWMRE_SPNBTN = SMJX_RET_SHOWMORE_SPANBX;
   if(SMJXRET_GTLSTDT === "" || SMJXRET_GTGRDDT === "")
   {
      SMJX_SRCH_SHWMRE_SPNBTN = SMJX_RET_NOMORE_SPANBXX;
   }                
  $("#SHM185-MOREAFTR").remove();                            
  $("#SHR86_SRCHPG_GRIDVIEW").append(SMJXRET_GTGRDDT);
  $("#SHR86_SRCHPG_LISTVIEW").append(SMJXRET_GTLSTDT);                   $("#SHWMORE_BTN_RMV24").html(SMJX_SRCH_SHWMRE_SPNBTN);
  }        
 });
  }
      });
  });
});

</script>

Leave a Comment