Ranjith M Ranjith M - 7 months ago 24
jQuery Question

Jquery Updated table view after successfull operation

I have a table in a page for example:-

<td><a href="$id" class="delete">Delete</a></td>

on the click of the delete it will go the controller through jquery and successfully delete the row, after that I want to show the updated table means without that deleted row. for this now I'm using another page and with the table data, on success I'm doing like this:


is there any other simple way to do this like without an another page?


Presumably "...will go the controller through jquery..." means via Ajax, so if you want it to just do a simple removal, just hide the row:

jsFiddle: https://jsfiddle.net/842x2wuc/

    $('.delete').click(function(e) {
        var thisBtn =   $(this);
            url: '/link/to/delete.php',
            type: 'post',
            data: { id: thisBtn.attr('href') },
            success: function(response) {
                // This will fade out the row