How to call ajax request one after another in php

<script>

$(document).ready(function()
{
   $(document).on("click", "._SP12_SHOWMORE", function()
   { 
       var datastring = {'SRCON':SMJX_ON, 'LCNT':SMJX_LST_CNT,};
      
       // FIRST AJAX REQUEST::
       $.ajax({
         url:'<?php echo base_url()."search-rd";?>',
         type: 'POST',
         data: datastring,
         success:function(rtb)
         {
           // SECOND AJAX REQUEST:: 
           $.ajax({
             url:'<?php echo base_url()."search-st";?>',
             type: 'POST',
             data: datastring,
             success:function(rta)
             {
                // WRITE YOUR CODE HERE           
             } 
           });
         }  
       }); 
     });
  });

</script>

 

Please follow and like us: