Good! I looked for some topics about the same doubt as mine - and I found, but I could not understand how to do it ... I have the following code snippet:
$c = array();
$c = buscaUsuario($conexao);
while($b = mysqli_fetch_assoc($c))
{?>
<tr>
<td><?php echo $b["user_name"]; ?></td>
<td><?php echo $b["user_fullname"]?></td>
<td><?php echo $b["user_email"]?></td>
<td>
<div class="btn-group">
<a class="btn btn-primary" href="#"><i class="icon_plus_alt2"></i></a>
<a class="btn btn-danger" onclick="deletarUsuario();"><i class="icon_close_alt2"></i></a>
</div>
</td>
And when you click on the delete button it will call a js function called deleteUsuario (), where the id of that item will be passed. In this function, it's where I have to use Ajax, but I do not know how to do it! I do not know how to join the delete + javascript + ajax query.
The reason I want to do this is that by clicking the remove this item button, it removes without needing to refresh the page.
This. With the variable $ b I can retrieve the id, like this:
$b['id'];
As I have no idea how to use Ajax, I was doing the following:
<a class="btn btn-danger" href="procura-cadastro.php?id=<?php echo $b['id'] ?>">
<?php
if(array_key_exists("id", $_GET) && $_GET['id'] == $b['id'])
{
$a = $_GET['id'];
$b = deletaUsuario($conexao, $a);
}
}
?>