I have this script:
<script type="text/javascript">
$(document).ready(function(){
$(document).on('click','.remove',function(e){
// e.preventDefault();
var data = $(this).data('file');
$.ajax({
type:'POST',
url:'/backup/delete',
data:'fileName='+data,
success: function(data){
$(this).parents('tr').remove();
}
},'json');
});
});
and document portion:
<tr>
<td>adif20150331133844.adi</td>
<td style="width: 2em"><span class="remove link" data-file="adif20150331133844.adi"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></span></td>
<td style="width: 2em"><span class="restore link" data-file="adif20150331133844.adi"><span class="glyphicon glyphicon-repeat" aria-hidden="true"></span></span></td>
</tr>
The task is to delete tr portion after file is removed. I cannot make it work. File is getting removed the respond is 200, OK but remove() doesnt work even if I replace success with complete in ajax. What could it be?