Sunday, June 14, 2015

Javascrpt dialog box using bootbox




Bootbox.js is a small JavaScript library which allows you to create programmatic dialog boxes using Bootstrap modals

Bootbox.js can be downloaded from:
http://bootboxjs.com/

Example of bootbox to creat cancel and OK dialog button
<script type='text/javascript' id='' src='bootstrap.min.js'></script>
<script type='text/javascript' id='' src='bootbox.min.js'></script>

      bootbox.dialog({
                                        message: "Are you sure you want to send out ROFR?",
                                        buttons: {
                                                cancel: {
                                                        label: "Cancel",
                                                        className: "btn-default btn-sm",
                                                        callback: function() {
                                                           // $('#mail').modal('show');
                                                        }
                                                },
                                                OK: {
                                                        label: "OK",
                                                        className: "btn-warning btn-sm",
                                                        callback: function() {
                                                            var postdata = {};
                                                            var url = ' ';
                                                                $.post(url, postdata, function(data) {
                                                   $("div#notice").html('mail is sent.');
                                       $("div#notice").css('display', 'block');
                                                           $("div#notice").fadeOut(5000);
                                                });

                                                        }
                                                },

                                        }
       });

No comments:

Post a Comment