当我尝试在第一个函数内部之后提醒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 });
});
答案 0 :(得分:2)
你应该将这个noty对象包含在parantheses中。我认为这就是问题。
编辑:ninja'd ..
答案 1 :(得分:1)
该行
noty{"text":"", ..., "closeOnSelfClick":true};
应该是
noty({"text":"", ..., "closeOnSelfClick":true});
你缺少括号。