繁体   English   中英

如何在我的网站中使用Sweet Alerts。

[英]How to use Sweet Alerts in my website..?

我在页面中使用“ Sweetalerts”。 我有一个静态链接,该链接应重定向到“ google.com”。 当我单击链接时,它将显示一条警告消息,指出

如果单击确定,您将被重定向到google.com。

一旦点击“ OK”,就会发生重定向。

问题是单击链接时我可以看到警报消息,但是该按钮不起作用。 它只是关闭警报消息,而不是重定向到适当的链接。

您是否尝试过swal的回调函数? 就像是

swal({   
   title: "Are you sure?",   
   text: "If you click OK you will be redirected to google.com",   
   type: "warning",   
   showCancelButton: true,   
   confirmButtonColor: "#DD6B55",   
   confirmButtonText: "OK",   
   closeOnConfirm: true}, 
   function(){ 
        window.location.href = "www.google.com"; 
   });

如果您发布代码段,它将帮助其他用户理解该问题。

  swal({ 
  title: "Alert",
   text: "Redirecting to google",
    type: "success" 
  },
  function(){
    window.location.href = 'www.google.com';
});

Swal Alert具有在操作后运行的回调函数的选项。

swal({   title: "Are you sure?" },
     function(){  window.location.href = "www.google.com";  });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM