jquery datatable delete records click button. Not select full row. only button click.
- <script>
- $(document).ready(function () {
- var tableTeam = $('#tblteam').DataTable();
- tableTeam.row().remove().draw(false);
- });
- </script>
- $("#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")
-
-
- $.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) {
-
- }
- });
- });
This is my code Please solve.