Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在发布URL之前显示Sweet警报_Php_Html_Regex_Sweetalert - Fatal编程技术网

Php 如何在发布URL之前显示Sweet警报

Php 如何在发布URL之前显示Sweet警报,php,html,regex,sweetalert,Php,Html,Regex,Sweetalert,我第一次使用SweetAlert。如何在发布URL之前显示确认警告。 我想在发布URL之前显示SweetAlert。谢谢 <!-- --> <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> <a href="<?=base_url();?>/method/post/<?= $data['id'] ?>" class="badge

我第一次使用SweetAlert。如何在发布URL之前显示确认警告。 我想在发布URL之前显示SweetAlert。谢谢

<!--  -->
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<a href="<?=base_url();?>/method/post/<?= $data['id'] ?>" class="badge badge-danger float-right ml-1" onclick='return onButton();'>hapus</a>
<script>
    function onButton(){
       event.preventDefault();
       swal({
            title: "Are you sure?",
            text: "Once deleted, you will not be able to recover this imaginary file!",
            icon: "warning",
            buttons: true,
            dangerMode: true,
        })
        .then((willDelete) => {
            if (willDelete) {

                swal("Poof! Your imaginary file has been deleted!", {
                    icon: "success",                                  
                });
            } else {
                swal("Your imaginary file is safe!");
            }
        });
    };
</script>
<!--  -->

函数onButton(){
event.preventDefault();
游泳({
标题:“你确定吗?”,
text:“一旦删除,您将无法恢复此虚拟文件!”,
图标:“警告”,
按钮:是的,
丹格莫德:没错,
})
。然后((将删除)=>{
如果(将删除){
swal(“噗!你想象的文件被删除了!”{
图标:“成功”,
});
}否则{
swal(“你想象的文件是安全的!”);
}
});
};

链接[/method/post/],如何在javascript中输入。我已经更新了代码,请检查。如果这个答案对你有帮助,那么请接受这个答案,这样可能对其他人有帮助
<link rel="stylesheet" type="text/css" href="http://192.168.2.40/Always_Fresh_Backend/backend/bower_components/sweetalert/css/sweetalert.css">

<script type="text/javascript" src="http://192.168.2.40/Always_Fresh_Backend/backend/bower_components/sweetalert/js/sweetalert.min.js"></script>

function sweetalert() {
 swal({
    title: "Are you sure?",
    text: "msg",
    type: "warning",
    showCancelButton: true,
    confirmButtonClass: "btn-danger",
    confirmButtonText: "Yes",
    closeOnConfirm: false
},
function(isConfirm){
    if (isConfirm) {
     $.ajax({
            url: "<?=BASEURL;?>/method/post/<?= $data['id'] ?>",
            type: "GET",
            beforeSend: function(){
            },
            complete: function(){
            },
            success: function (response) { 

            }
        });
    } else {

    }