$(document).ready(function(){

  $(document).on('click', '.pi_trashbtnRestore', function () {
    
    var gettingid=$(this).data('id');

    console.log("hello");
    console.log(gettingid);

    restorepi(gettingid);

  });

});


function restorepi(gettingid)
{
  $.ajaxSetup({

    headers: {

        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')

    } 

  });
 

  $.ajax({ 
  
    url:url_restorepi,

    method:"POST",

    data:{gettingid:gettingid},

    success:function(result)

    {
      $("#pi-trash").modal('hide');

      $('#pi_trashedlist').empty();

      var success="";

      success=success+
      
      '<p style="text-align:center;"><b>PI Restore Successfully !!!</b></p>';
      
      $('#pi_success').append(success);
      $('#pi_success').removeClass("hide");
      
      setTimeout(function(){
        location.reload();
      }, 200);

    }

 });

}