Refresh table when an item is updated

0

I have this Ajax

$(function() {
    //function ajax
    $('.processPreset').click(function(e) {
        e.preventDefault();
        var checkedNames = '';
        var $things = $('.case:checked');
        if ($things.length > 0) {
            for (var i = 0; i < $things.length; i++) {
                checkedNames += $($things[i]).closest('tr').find('td:first').text();
                console.log(checkedNames);
            }

           $.ajax({
            url: 'http://localhost:3000/processPreset',
            method: 'post',
            data: { idArticulo: checkedNames },
            success: function(res) {
                console.log(res);
               // RefreshTable();
               //checkedNames += $($things[i]).closest('tr').find('td:first').remove();
            }
        });
        } else {
            alert('No tiene articulo seleccionado');
        }


    });

});

Which makes me save a field from the table

What I am trying to do is that when I save, I remove the field from the table, either by deleting or refreshing the table

    
asked by Eduard 13.07.2017 в 18:44
source

2 answers

1

It is enough for you to select the checkbox that is marked, then you select the far father who is the tr to finally apply remove .

$('.case:checked').eq(0).parent().parent().remove();
    
answered by 13.07.2017 / 22:09
source
0

In the same way that you use this $($things[i]).closest('tr').find('td:first').text(); to get the name, apply a hide , something like $($things[i]).closest('tr').hide() if what you want is just to stop showing the row. If you want to delete it $($things[i]).closest('tr').remove()

    
answered by 13.07.2017 в 18:52