jquery datatable delete records click button. Not select full row. only button click.
- $("#tblteam").on('click', '.btndelete', function (e) {
- var ab = $(this).closest("tr");
- var tableTeam = $('#tblteam').DataTable();
- var row = this.closest('tr');
- ab.remove();
- var FavId = $(this).attr("data-Id")
- var type = $(this).attr("data-Name")
- //var FavId = $(this).parent().attr("data-Id")
- //alert(FavId);
- $.ajax({
- url: '/FavouriteManagement/Delete?id=' + FavId,
- type: 'POST',
- data: { "FavId": FavId, "Type": type },
- async: false,
- success: function (data) {
- if (data.status == true) {
- $(this).closest('tr').remove();
- tableTeam.row(row).remove().draw(false);
- }
- else {
- alert("Something went wrong");
- return false;
- }
- },
- error: function (data) {
- //alert('Problem in deleting user:' + data.responseText);
- }
- });
- });
This is my code Please solve.
Vinay SinghPosted Mar 24, 2020, 8:30 AM