JSFiddle - React, Tailwind, and code Playground

HTML

<div id="wrapper">This script not connected with database
    <div class="list" id="list_1">
        <div class="name"><a href="test.com">PHP Cookie Ajax Based Poll Script</a>
        </div>
        <div class="flash" id="flash_1"></div>
        <div class="delete"><a href="javascript:void()"><img alt="Delete" title="Delete" width="20" src="image/delete.jpg" onclick=deleteBox("1") border="0"></a>
        </div>
    </div>
    <div class="list" id="list_2">
        <div class="name"><a href="test.com">Live Username Availability Check with Ajax and PHP</a>
        </div>
        <div class="flash" id="flash_2"></div>
        <div class="delete"><a href="javascript:void()"><img alt="Delete" title="Delete" width="20" src="image/delete.jpg" onclick=deleteBox("2") border="0"></a>
        </div>
    </div>
    <div class="list" id="list_3">
        <div class="name"><a href="tets.com">PHP Ajax Pagination Tutorial</a>
        </div>
        <div class="flash" id="flash_3"></div>
        <div class="delete"><a href="javascript:void()"><img alt="Delete" title="Delete" width="20" src="image/delete.jpg" onclick=deleteBox("3") border="0"></a>
        </div>
    </div>
    
</div>

JavaScript

function deleteBox(id) {
    if (confirm("Are you sure you want to delete this record?")) {
        var dataString = 'id=' + id;
        $("#flash_" + id).show();
        $("#flash_" + id).fadeIn(400).html('<img src="image/loading.gif" /> ');
        $.ajax({
            type: "POST",
            url: "delete.php",
            data: dataString,
            cache: false,
            success: function (result) {
                if (result) {
                    $("#flash_" + id).hide();
                    // if data delete successfully
                    if (result == 'success') {
                        //Check random no, for animated type of effect
                        var randNum = Math.floor((Math.random() * 100) + 1);
                        if (randNum % 2 == 0) {
                            // Delete with slide up effect
                            $("#list_" + id).slideUp(1000);
                        } else {
                            // Just hide data
                            $("#list_" + id).hide(500);
                        }

                    } else {
                        var errorMessage = result.substring(position + 2);
                        alert(errorMessage);
                    }
                }
            }
        });
    }
}