[英]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.