mercredi 20 juillet 2016

Jquery delete row with ajax call

I have the following function that deletes an entire row:

$(".deleteTR").click(function(e){

            if (confirm("Are you sure you want to delete this entry?")) {

                $(this).closest('tr').remove();
            }

            return false;
        })

I want to go to the controller where the delete function is placed, I tried to use this ajax call but it is not working and it doesn't go to the controller:

                $.ajax({
                type: "POST",
                url: '@Url.Action("Delete", "Application")',
                data:  JSON.stringify( app),
                dataType: "json",
                contentType: "application/json",
                cache: false,
                success: function (data) {
                    //show content
                    alert ('success')
                },

            });

Aucun commentaire:

Enregistrer un commentaire