Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

171
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda