remove row from table with XMLHttpRequest() code example
Example: remove row from table with XMLHttpRequest()
$(document).ready(function(){
$('.delete').click(function(){
var el = this;
var id = this.id;
var splitid = id.split("_");
var deleteid = splitid[1];
$.ajax({
url: 'remove.php',
type: 'POST',
data: { id:deleteid },
success: function(response){
if(response == 1){
$(el).closest('tr').css('background','tomato');
$(el).closest('tr').fadeOut(800,function(){
$(this).remove();
});
}else{
alert('Invalid ID.');
}
}
});
});
});