我正在敲这个脚本的头,我不能让我的函数在Aletify.js警报中显示。
一些帮助将是非常有用的;-)
函数:
Oshoplang = {
// System Message Text
RemoveError: '<p>This item has now been removed from your cart.\n\nThank you.',
Added: 'Has now been added to your cart',
OutOfStock: '<p>This item is not currently available or is out of stock.</p>',
PreOrder: '<p>Your pre-order has been made successfully.\n\nThank you.</p>',
InvalidQuantity: '<p>It looks like you entered an invalid quantity.\n\nPlease try again.</p>',
}
window.alert = function() {};
$("#confirm-else").on('click', function() {
reset();
$('#e-content').addClass('blur');
alertify.alert(Oshoplang, function(e) {
if (e) {
alertify.success("OK");
$('#e-content').removeClass('blur');
location.reload();
} else {
alertify.error("You've clicked Cancel");
}
});
return false;
});我通常不会在运行过程中收到消息,但这样做,但我相信我已经接近了:-)
发布于 2015-09-16 18:24:29
我不确定您是否仍然有这个问题,但我相信alertify.alert函数没有任何回调,因为它只是一种显示消息的方式。您可能正在寻找alertify.confirm。
消息也没有显示,因为alertify.alert或alertify.confirm的第一个参数需要是字符串。在您的示例中,您正在传递一个对象。
我已经设置了您的代码的演示,该代码已调整为在here on JSFiddle上工作。
值得注意的是,代码示例使用的是alertify的旧版本(0.3),并且已经更新,因此版本1的which is now out将具有稍微调整过的语法。
https://stackoverflow.com/questions/27026684
复制相似问题