jquery“noty”;插件不工作

发布于 2025-01-07 01:30:46 字数 966 浏览 0 评论 0原文

当我尝试在上面的第一个函数内提醒 id 时 var ajax0 = false;即使我不提醒 id,它也不会发出警报,并且对话框根本不会显示,因为它不存在并且已在文档中准备就绪

$(document).on("click","a.del_cart",function(){
var id = $(this).attr("title");
noty({ text: 'product will be deleted',"modal":"true","layout":"center", buttons: [{type: 'button green', text: 'Ok', click: function() {
var ajax0 = false;
ajax0 = new XMLHttpRequest();
var qst0 = "?id="+id;
ajax0.open("POST","ajax/del_product.php"+qst0);
    noty({"text":"cancelled successfully.","layout":"center","type":"success","textAlign":"center","easing":"swing","animateOpen":{"height":"toggle"},"modal":"true","animateClose":{"height":"toggle"},"speed":"500","timeout":"2000","closable":true,"closeOnSelfClick":true});
    $(".cart").fadeOut(100,function(){
        display_cart();
        $(".cart").fadeIn(2000);
    });
ajax0.send(null);
 } }, {type: 'button pink',text: 'Cancel', click: function() { /**/ } }],closable: false,timeout: false });
});

when i try to alert the id after inside the first function which is just above
var ajax0 = false; it doesn't alert and the dialog box doesn't show at all even if i don't alert the id as it doesn't exist and it's inside document ready

$(document).on("click","a.del_cart",function(){
var id = $(this).attr("title");
noty({ text: 'product will be deleted',"modal":"true","layout":"center", buttons: [{type: 'button green', text: 'Ok', click: function() {
var ajax0 = false;
ajax0 = new XMLHttpRequest();
var qst0 = "?id="+id;
ajax0.open("POST","ajax/del_product.php"+qst0);
    noty({"text":"cancelled successfully.","layout":"center","type":"success","textAlign":"center","easing":"swing","animateOpen":{"height":"toggle"},"modal":"true","animateClose":{"height":"toggle"},"speed":"500","timeout":"2000","closable":true,"closeOnSelfClick":true});
    $(".cart").fadeOut(100,function(){
        display_cart();
        $(".cart").fadeIn(2000);
    });
ajax0.send(null);
 } }, {type: 'button pink',text: 'Cancel', click: function() { /**/ } }],closable: false,timeout: false });
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

过度放纵 2025-01-14 01:30:46

您应该将 noty 对象放在括号内。我认为这就是问题所在。

编辑:忍者..

You should encase the noty object within parantheses. I think that is the problem.

edit: ninja'd ..

梦毁影碎の 2025-01-14 01:30:46

该行

noty{"text":"", ..., "closeOnSelfClick":true};

应该是

noty({"text":"", ..., "closeOnSelfClick":true});

您缺少括号。

The line

noty{"text":"", ..., "closeOnSelfClick":true};

Should be

noty({"text":"", ..., "closeOnSelfClick":true});

You are missing parentheses.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文