我在頁面中使用「Sweetalerts」。 我有一個應該重定向到「google.com」的靜態鏈接。當我點擊鏈接,如果您單擊確定將盡快爲一體的命中重定向到google.com,如何在我的網站上使用Sweet Alerts ..?
應當顯示一個警告信息,說明
「OK」重定向發生。
問題是,我可以看到警報消息,同時點擊鏈接,但該按鈕不起作用。它只是關閉警報消息,而不是重定向到適當的鏈接。
我在頁面中使用「Sweetalerts」。 我有一個應該重定向到「google.com」的靜態鏈接。當我點擊鏈接,如果您單擊確定將盡快爲一體的命中重定向到google.com,如何在我的網站上使用Sweet Alerts ..?
應當顯示一個警告信息,說明
「OK」重定向發生。
問題是,我可以看到警報消息,同時點擊鏈接,但該按鈕不起作用。它只是關閉警報消息,而不是重定向到適當的鏈接。
swal({
title: "Alert",
text: "Redirecting to google",
type: "success"
},
function(){
window.location.href = 'www.google.com';
});
您是否嘗試過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 Alert提供了一個動作後執行的回調函數的選項。
swal({ title: "Are you sure?" },
function(){ window.location.href = "www.google.com"; });
這不能是問題的答案,它必須在評論部分 – Greenhorn
這應該是一個評論。 – AkshayJ
沒有我添加.. –