Remove a tablerow in an Ajax callback, but Ajax won't get past readyState 1

38 Views Asked by At

I'm trying to remove a tablerow. It seems that it only gets to readyState 1

Here it is:

var element = $('table:nth-child(5)>tbody>tr:nth-child(5)');
   $.ajax({
     success: function(){          
        element.remove();     
   }
});
1

There are 1 best solutions below

0
On

In the 'readystate' success method, the element will not be defined. Define the same in the success as shown below.

$.ajax({
     success: function(){   
        var element = $('table:nth-child(5)>tbody>tr:nth-child(5)');       
        element.remove();     
   }
   });