JSFiddle - React, Tailwind, and code Playground
HTML
<input type="button" class="but" id="42" value="Удалить" />
JavaScript
$('.but').on('click', function() {
$.ajax({
type: "POST",
url: "delete.php",
data: { fname: this.id },
success: function() {
$(this).remove();
},
})
})