$('.sweetalert-warning').click(function (e) {
    e.preventDefault(); // Prevent the href from redirecting directly
    var linkURL = $(this);
    warnBeforeRedirect(linkURL);
});

function warnBeforeRedirect(linkURL) {
    swal({
        title: linkURL.attr('data-title'),
        text: linkURL.attr('data-text'),
        type: "warning",
        showCancelButton: true,
    }, function () {
        // Redirect the user
        window.location.href = linkURL.attr("href");
    });
}
