我正在使用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>
答案 0 :(得分:2)
更改此行...
$.ajax({ url: 'script.php?hidenoty=true' });
到此......
window.location.href = 'script.php?hidenoty=true';
ajax
专门用于加载而不用更改页面的内容,因此与您想要的相反:)