Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ReferenceError: swal is not defined detele function not working #138

Closed
vinithav opened this issue May 2, 2022 · 2 comments
Closed

Comments

@vinithav
Copy link

vinithav commented May 2, 2022

My code

$(function() {
$(document).on('click', '.text-danger', function() {

  var id = $(this).attr('id');
  var $ele = $(this).parent().parent();
  var rate_delete = 'rate_delete';

  swal({
      title: "Are you sure?",
      text: "Do You Really Want to Delete !",
      icon: "warning",
      buttons: true,
      dangerMode: true,
    })
    .then((willDelete) => {
      if (willDelete) {
        $.ajax({
          type: 'POST',
          url: 'ajax-helper.php',
          data: {
            'id': id,
            rate_delete: rate_delete
          },
          success: function(data) {
            $ele.fadeOut().remove();
            location.reload();
          }
        });
      } else {}
    });
});

});

@realrashid
Copy link
Owner

Hey @vinithav ,

Use

Swal.fire({});

And also enabled the alwaysLoadJS in you .env file

SWEET_ALERT_ALWAYS_LOAD_JS=true

@realrashid
Copy link
Owner

Closed due to inactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants