remove row from table with xmlhttprequest 28 29

Solutions on MaxInterview for remove row from table with xmlhttprequest 28 29 by the best coders in the world

showing results for - "remove row from table with xmlhttprequest 28 29"
Elia
15 Jun 2018
1$(document).ready(function(){
2
3 // Delete 
4 $('.delete').click(function(){
5   var el = this;
6   var id = this.id;
7   var splitid = id.split("_");
8
9   // Delete id
10   var deleteid = splitid[1];
11 
12   // AJAX Request
13   $.ajax({
14     url: 'remove.php',
15     type: 'POST',
16     data: { id:deleteid },
17     success: function(response){
18
19       if(response == 1){
20	 // Remove row from HTML Table
21	 $(el).closest('tr').css('background','tomato');
22	 $(el).closest('tr').fadeOut(800,function(){
23	    $(this).remove();
24	 });
25      }else{
26	 alert('Invalid ID.');
27      }
28
29    }
30   });
31
32 });
33
34});