0
I have a user table and would like when clicking the edit button to load the edit form without refreshing the page with the id selected using jquery would be possible? below follows the code:
<table class="table">
<thead class="thead bg-info text-light">
<tr>
<th scope="col">ID</th>
<th scope="col">Nome</th>
<th scope="col">E-mail</th>
<th scope="col">Nível</th>
<th scope="col">Editar</th>
<th scope="col">Excluir</th>
</tr>
</thead>
<tbody>
<?php
include "../config/cnn.php";
$query = $pdo->query("Select * FROM USUARIOS;");
while ($linha = $query->fetch(PDO::FETCH_ASSOC))
{
echo'<tr>';
echo'<td>'."{$linha['id']}".'</td>';
echo'<td>'."{$linha['administrador_nome']}".'</td>';
echo'<td>'."$linha['administrador_email']}".'</td>';
echo'<td>'."$linha['administrador_nivel']}".'</td>';
echo'<td><a id="edituser"href="'."../frmEditar/frmEditUser.php?id="."{$linha['id']}".'">
<span><i class="far fa-edit"></i></span></a></td>';
echo'<td><a>
<span><i class="fas fa-trash"></i></span></a></td>';
echo'</tr>';
}?>
</tbody>
</table>
Abaixo segue o script jquery que estou usando no sistema
<script>
$("#edituser").click(function(){
$("#main").load("../frmEditar/frmEditUser.php");
});
</script>
Are you sure you want to load one page into another? Wouldn’t it be better to capture the
id
and take to an edit page?– Jorge.M
Yes, but I could do it without refreshing the page?
– Fabio
Da yes. Search by AJAX
– Jorge.M