Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

170
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!