Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

172
Visualizações
Javascript deletion animation does not occur after successful record deletion

After a record is successfully deleted from the table, I would like for the row to turn red, before fading out and not showing in the users view anymore. None of this is happening for me at the moment, with the only action (the effected table row being removed) only being removed upon refreshing the browser.

PHP (file name deletion.php)

if (isset($_POST['ID'])) {
    $ID = $_POST['ID'];

    if ($conn->query("DELETE FROM user WHERE `ID` = '$ID'") === true) {
        $response = array(
        'status' => true,
        'message' => "Your listing was deleted successfully"
        );
    } else {
        $response = array(
        'status' => false,
        'message' => $conn->errno
        );
    }
    echo json_encode($response);
}

Javascript

$(document).ready(function () {
    // catch click
    $('.mlButton').click(function () {
        var el = this;
        var confirmAlert = confirm("Are you sure? This action can not be undone.");
        if (confirmAlert == true) {
            // AJAX Request
            $.ajax({
                url: 'deletion.php',
                type: 'POST',
                data: {
                    ID: $(this).val()
                },
                success: function (response) {
                    console.log(response);
                    if (response.status) {
                        toastr.success(response.message);
                        el.closest('tr').css('background', 'tomato');
                        el.closest('tr').fadeOut(800, function () {
                            $(this).remove();
                        });
                    } else {
                        toastr.error(response.message);
                    }
                }
            });
        }
    });
});

In the console and network response tab, I am getting the correct status and message response, with status = true and message = Your listing was deleted successfully

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda