3
I need to make sure that when clicking on the link it removes this element tr that is the link, someone can help me?
 <?php foreach ($emails as $v): ?>
   <tr>
       <td><?= $v->id; ?></td>
       <td><?= $v->email; ?></td>
       <td class="actions">
         <a href="javascript:void(0);" id="<?= $v->id; ?>" class="delete-row delete-newsletter"><i class="fa fa-trash-o"></i></a>
       </td>
    </tr>
  <?php endforeach; ?>
This is my ajax, I tried to do it this way but it deletes all tr, I know you need to access the parent element, but as I can delete the parent element of this id that the guy clicked?
$(".delete-newsletter").click(function(){
    var id = this.id;
    $.ajax({
       url: path +'administrador/deletarNewsletter',
       type: 'POST',
       data: {
           usuario: id
       },
       success: function (response) {
           console.log(response);
            if (parseInt(response) === 1) {
                $("tr").remove(); // Aqui ele apaga todos os tr, sendo que quero apagar o que ele clicou 
                console.log('apagado!');
            } else {
                console.log('deu merda');
            }
        },
        error: function (erro, er) {
            console.log(erro, er);
        }
    });
});
Sergio, can I insert a visual example in your reply? :)
– MarceloBoni
Hello guys, thanks for the help, solved my problem and got simpler Sergio, thanks even!
– viniciussvl
@Marceloboni yes, of course. I’m sorry I spoiled your answer :) If it’s not exactly the same you can add it to it.
– Sergio
@Sergio includes an example basic, I hope you don’t mind
– MarceloBoni