gpt4 book ai didi

javascript - jquery noty on close goto a url

转载 作者:行者123 更新时间:2023-12-02 18:15:45 24 4
gpt4 key购买 nike

我正在使用 jquery noty 插件,当有人单击弹出窗口时,我希望它转到一个 URL(如下),但我无法弄清楚这一点...有人可以给我一个快速修复吗..?

我希望它转到的 URL:script.php?hidenoty=true

<script type="text/javascript">
function generate(layout) {
var n = noty({
text: "<?php echo $motd?>",
type: 'warning',
dismissQueue: true,
layout: layout,
theme: 'defaultTheme',
animation: {
open: {height: 'toggle'},
close: {height: 'toggle'},
easing: 'swing',
speed: 500 // opening & closing animation speed
},
timeout: false, // delay for closing event. Set false for sticky notifications
force: false, // adds notification to the beginning of queue when set to true
modal: false,
maxVisible: 3, // you can set max visible notification for dismissQueue true option
closeWith: ['click'], // ['click', 'button', 'hover']
callback: {
onShow: function() {},
afterShow: function() {},
onClose: function() {
$.ajax({ url: 'script.php?hidenoty=true' });
},
afterClose: function() {}
},
buttons: false // an array of buttons
});
console.log('html: '+n.options.id);
}

function generateAll() {
generate('topCenter');
}

$(document).ready(function() {

generateAll();

});
</script>

最佳答案

更改此行...

$.ajax({ url: 'script.php?hidenoty=true' });

对此...

window.location.href = 'script.php?hidenoty=true';

ajax 专门用于加载某些内容而不更改页面,因此与您想要的相反:)

关于javascript - jquery noty on close goto a url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19322986/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com