jquery“noty”;插件不工作
当我尝试在上面的第一个函数内提醒 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该将 noty 对象放在括号内。我认为这就是问题所在。
编辑:忍者..
You should encase the noty object within parantheses. I think that is the problem.
edit: ninja'd ..
该行
应该是
您缺少括号。
The line
Should be
You are missing parentheses.