I have use this code for delete record with sweet aleart .It's not working with sweet aleart and without sweet aleart it's working .please help me.
- $(document).ready(function () {
- $("#Report").on('click', '.btndelete', function () {
- swal({
- title: "Confirmation?",
- text: "Are you sure you want to delete record?",
- type: "warning",
- confirmButtonClass: "btn-danger",
- showCancelButton: true,
- confirmButtonText: "Yes,Please Delete it!",
- closeOnConfirm: false
- }, function () {
- swal("Deleted!", "Data has been successfully deleted.", "success");
- });
- var ab = $(this).closest('#item');
- ab.remove();
- var id = $(this).attr('id');
- $.ajax({
- url: "DeleteReport",
- type: "POST",
- data: { "ContactUsId": id },
- success: function (data) {
- if (data.status == true) {
- $(this).closest('#item').remove();
- }
- else {
- alert("Something went wrong");
- return false;
- }
- },
- error: function (er) {
- alert(er);
- return false;
- }
- });
- });
- });