Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/475.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
Javascript 甜警报不适用于单击按钮,单击按钮时警告未显示_Javascript_Php_Ajax - Fatal编程技术网

Javascript 甜警报不适用于单击按钮,单击按钮时警告未显示

Javascript 甜警报不适用于单击按钮,单击按钮时警告未显示,javascript,php,ajax,Javascript,Php,Ajax,代码不会在单击“删除”按钮时给出任何响应,同时也不会显示任何 调试代码时出错,并且在调试模式下未显示任何错误 $("#delete").click(function(){ var radioValue = $("input[name='clvl']:checked").val();//radio button value function delcal(){ swal({

代码不会在单击“删除”按钮时给出任何响应,同时也不会显示任何
调试代码时出错,并且在调试模式下未显示任何错误

        $("#delete").click(function(){
            var radioValue = $("input[name='clvl']:checked").val();//radio button value
            function delcal(){  
            swal({
                    title: "Are you sure?",
                    text: "Your Data Deleted permennatly Deleted!",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "Yes, delete it!",
                    cancelButtonText: "No, cancel plx!",
                    closeOnConfirm: false,
                    closeOnCancel: false },
                function (isConfirm) {
                    if (isConfirm) {
                        $.ajax({
                                type: "POST",
                                url: "deleteclient.php", //call to file
                                data: {
                                    action: 'editClient', 
                                    clientId:radioValue
                                    },
                                success: function(response) {
                                    //alert(response);

                                },
                                error: function (jqXhr, textStatus, errorMessage) { //error callback  

                                    alert('Error: ' + errorMessage );
                                } 
                        }); 
                        swal("Deleted!", "Your imaginary file has been deleted.", "success");
                    } else {
                        swal("Cancelled", "Your imaginary file is safe :)", "error");
                    }
                });
            }


        });

swal(“已删除!”,“您想象的文件已被删除。”,“成功”);在ajax中应该是成功的。好的,我会检查它并记住当你使用ajax时,总是在回调中验证ajax响应(在成功中)。在响应检查时不会发生相同的错误。你是否在某处调用/触发你的函数
delcal()