I’m try to remove the deleted table row after it’s been successfully deleted from the database but it not working. Here is my code.
This works:
$('table td img.delete').click(function(){
if(confirm("Are you sure you want to permanently delete this?"))
$(this).parent().parent().remove();
}
});
This doesn’t work:
$('table td img.delete').click(function(){
if(confirm("Are you sure you want to permanently delete this?"))
$.get('cfc/action.cfc?method=deleteLetter&returnformat=plain', {id: $(this).attr('id')},
function(data){
if(data.replace(/^\s+|\s+$/g, '')==='ok'){
$(this).parent().parent().remove();
}
});
}
});
This record get deleted here but the table row remains. Any suggestion would be much appreciated.
thanks!
This will work.
When you say this in anonymous method/function then “this” showing to that method or object where code is executed, But if you assign $(this) to variable then you can use it anywhere.