Jquery pop up confirm Bootbox Bootstrap

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>My page</title>
    <link rel="stylesheet" type="text/css" href="../assets/css/bootstrap.min.css">
</head>
<body>

    <!-- JS dependencies -->
    <script src="../assets/js/jquery.js"></script>
    <script src="../assets/js/bootstrap.min.js"></script>
    <a class="btn btn-mini btn-danger lnk-delete" data-toggle="modal"
       href="#delete-confirm" data-data="Sebuah Data"
       data-url="https://www.linkHapusItemTertentu.com/">
       <i class="icon-remove icon-white"></i>Delete</a>
    <!-- bootbox code -->
    <script src="../assets/js/bootbox.js"></script>
    <script>
    $(document).ready(function() {
        $('a[href=#delete-confirm]').click(function(e) {
          //var data = $(this).data('data');
          //var data = $(this).data('data');
          //alert(url+" "+data);

          //Link untuk menghapus
          var url = $(this).data('url');
          bootbox.dialog('Anda yakin akan menghapus data?', [{
                         'label':'Hapus',
                         'class':'btn btn-danger',
                         'icon':'icon-trash icon-white',
                         'callback':function() {
                                return location.href = url;
                         }
                        },
                        {
                         'label':'Batal',
                         'class':'btn'
                        }]);
       });
   });

   </script>

</body>
</html>

source code dapat di unduh di sini

2 Responses to Jquery pop up confirm Bootbox Bootstrap

  1. Calamardo says:

    Yo can adapte this script to Bootbox v 4.x.x whit bootstrap 3.x ? thanouky

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: