Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/73.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
Jquery sweetAlert-单击确认按钮时不调用函数_Jquery_Css_Asp.net - Fatal编程技术网

Jquery sweetAlert-单击确认按钮时不调用函数

Jquery sweetAlert-单击确认按钮时不调用函数,jquery,css,asp.net,Jquery,Css,Asp.net,我通过以下方式添加了以下警报,但当我单击“取消”或“确认”按钮时,没有调用任何函数,我是否做错了什么?我的母版页有指向css的链接: sweetAlert({ html: true, title: 'Error', text: "test", type: 'warning', showCancelButton: t

我通过以下方式添加了以下警报,但当我单击“取消”或“确认”按钮时,没有调用任何函数,我是否做错了什么?我的母版页有指向css的链接:

            sweetAlert({
                html: true,
                title: 'Error',
                text: "test",
                type: 'warning',
                showCancelButton: true,
                confirmButtonText: 'Check',            
            }).then((result) => {
                if (result.value) {
                    sweetAlert("Yes", "Blah", "info");
                } else {                   
                    sweetAlert("No", "Blah", "info");
                }
                });

如果您使用的是
jQuery
,请在要调用操作的DOM元素上附加click事件,并弹出
SweetAlert
弹出窗口。使用
SweetAlert
SweetAlert
实例触发(
fire
)事件

以下示例将帮助您从以下内容开始:

$(函数(){
常量事件={
单击:“单击”
};
const$button=$('somethingToDo');
$button.on(events.click,函数(event){
常量配置={
是的,
标题:“错误”,
文本:“测试”,
键入:“警告”,
showCancelButton:true,
confirmButtonText:“检查”,
};
//第一变体
sweetAlert.fire(配置)。然后(回调);
函数回调(结果){
if(result.value){
//第二种变体
SweetAlert.fire(“是”、“废话”、“信息”);
}否则{
//第二种变体
SweetAlert.fire(“否”、“废话”、“信息”);
}
}
});
})

做点什么

Sweet alert还需要包含其.js文件