I have an AJAX function (below). I am trying to pass an input from one page to another.
It redirects me to the other page but does not pass the required value.
I do not understand why it doesn't work as I expected.
I am looking for another way to do this. Any help will be appreciated.
  //second page
  
  <?php
     $cuit = $_POST['cuit'];
    ?>
<input id="act" type="text" class="form-control" value="<?php echo $cuit ?>">function mod(id, origen) {
  swal({
    title: 'Are you sure?',
    text: "You won't be able to revert this!",
    type: 'warning',
    showCancelButton: true,
    confirmButtonColor: '#3085d6',
    cancelButtonColor: '#d33',
    confirmButtonText: 'Yes, delete it!',
    cancelButtonText: 'No, cancel!',
    confirmButtonClass: 'btn btn-success',
    cancelButtonClass: 'btn btn-danger',
    buttonsStyling: false
  }).then(function() {
    if (origen == "perfiles") {
      $.post("api/eliminar_perfil.php", {
        id: id
      }, function(mensaje) {
        $("#tr_" + id).remove();
      });
    } else if (origen == "index") {
      $.ajax({
        type: "post",
        url: "perfiles.php",
        data: {
          cuit: $("#cuit").val()
        },
        success: function(result) {
          location.href = 'http://localhost/miramonteapp/perfiles.php';
        }
      });
    }
    swal('Deleted!', 'Your file has been deleted.', 'success')
  }, function(dismiss) {
    // dismiss can be 'cancel', 'overlay',
    // 'close', and 'timer'
    if (dismiss === 'cancel') {
      swal('Cancelled', 'Your imaginary file is safe :)', 'error')
    }
  })
}<input id="cuit" type="text" class="form-control" onkeyup="searchCliente();">
<button id="btnBuscar" onclick="mod($('#cuit'), 'index');" type="button" class="btn btn-default" name="button">Buscar</button> 
     
    