1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
   |  
<form action="delete.php" method="post" name="myForm">
                                    <button type="submit" class="btn btn-primary waves-effect" id="bouh">CLICK ME</button>
               </form>
                                    <script>
                                        $('button.btn-primary').click(function () {
                                            var btnId = $(this).attr("id");
                                            warning(btnId);
                                        });
 
                                        function warning(btnId) {
                                            swal({
                                                title: "Are you sure?",
                                                text: "You will not be able to recover this imaginary file!",
                                                type: "warning",
                                                showCancelButton: true,
                                                confirmButtonColor: "#DD6B55",
                                                confirmButtonText: "Yes, delete it!",
                                                cancelButtonText: "No, cancel plx!",
                                                closeOnConfirm: false,
                                                closeOnCancel: false
                                            }, function (isConfirm) {
                                                if (isConfirm) {
                                                    swal("Deleted!", "Your imaginary file has been deleted.", "success");
                                                } else {
                                                    swal("Cancelled", "Your imaginary file is safe :)", "error");
                                                }
                                            });
                                        }
                                    </script> | 
Partager