Greetings my stackoverflow people, I have searched everywhere and can not find how to send the value of a variable captured with a click from ajax to php and redirects me to the php with which I will develop this data:
$(document).ready(function(){
$('#tabla').load('tabla.php');
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Consulta tabla SQL</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<center>
<label>
<h3>Consulta MySQL</h3>
</label>
</center>
<div id="tabla"></div>
</body>
</html>
var pagina=
$(document).ready(function(){
$('table').on('click', 'td', function(){
var datos = $(this).prop('id');
alert('El Valor del ID es...:'+datos);
})
});
<?php
$conect=mysqli_connect('localhost','root','','prueba');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<br>
<div class="container col-sm-6 col-sm-offset-3">
<table class="table table-bordered table-hover">
<thead>
<tr class="success" align="center">
<td><strong>ID</strong></td>
<td><strong>NOMBRE</strong></td>
<td><strong>APELLIDOS</strong></td>
<td><strong>NIVEL</strong></td>
<td><strong>TELEFONO</strong></td>
</tr>
</thead>
<tbody>
<?php
$sql= "SELECT * FROM usuario";
$result=mysqli_query($conect, $sql);
while ($mostrar=mysqli_fetch_array($result)) {
?>
<tr>
<td id="<?php echo $mostrar['id']?>"><?php echo $mostrar['id']?></td>
<td id="<?php echo $mostrar['id']?>"><?php echo $mostrar['nombres']?></td>
<td id="<?php echo $mostrar['id']?>"><?php echo $mostrar['apellidos']?></td>
<td id="<?php echo $mostrar['id']?>"><?php echo $mostrar['nivel']?></td>
<td id="<?php echo $mostrar['id']?>"><?php echo $mostrar['telefono']?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</body>
</html>
and I want the result to be displayed here:
<?php
$conect=mysqli_connect('localhost','root','','prueba');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<title>Perfil del Usuario</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<br><br><br>
<div class="row">
<div class="container col-sm-4 col-sm-offset-4">
<div class="panel panel-primary">
<div class="panel-heading" style="text-align: center"><strong>Perfil General del Usuario</strong> </div>
<div class="panel-body">
<?php
$datos = $_POST['datos'];
$log = mysqli_query($conect,"SELECT * FROM usuario WHERE id='$datos'");
if (mysqli_num_rows($log)>0) {
$row = mysqli_fetch_array($log);
}
?>
<table class="table table-hover table-condensed table-bordered">
<tr>
<th class="success col-sm-3">ID</th>
<td><?php echo $row['id'] ?></td>
</tr>
<tr>
<th class="success col-sm-3">NOMBRES</th>
<td><?php echo $row['nombres'] ?></td>
</tr>
<tr>
<th class="success col-sm-3">APELLIDOS</th>
<td><?php echo $row['apellidos'] ?></td>
</tr>
<tr>
<th class="success col-sm-3">GRADO</th>
<td><?php echo $row['grado'] ?></td>
</tr>
<tr>
<th class="success col-sm-3">TELEFONO</th>
<td><?php echo $row['telefono'] ?></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
I appreciate all your help ..