0

我正在使用 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>
4

1 回答 1

2

改变这一行...

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

对这个...

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

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

于 2013-10-11T16:35:26.367 回答