Javascript 将函数传递给alertify.js
我对这个脚本非常感兴趣,我无法在Aletify.js警报中显示我的函数 一些帮助将是难以置信的帮助- 职能:Javascript 将函数传递给alertify.js,javascript,jquery,arrays,function,alertify,Javascript,Jquery,Arrays,Function,Alertify,我对这个脚本非常感兴趣,我无法在Aletify.js警报中显示我的函数 一些帮助将是难以置信的帮助- 职能: Oshoplang = { // System Message Text RemoveError: '<p>This item has now been removed from your cart.\n\nThank you.', Added: 'Ha
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;
});
我通常不会在运行过程中收到消息,但通过这种方式,但我相信我离某个地方很近:-不确定您是否仍然存在此问题,但我相信alertify.alert函数没有任何回调,因为它只是显示消息的一种方式。您可能正在查找alertify.confirm 消息也没有显示,因为alertify.alert或alertify.confirm的第一个参数需要是字符串。在您的示例中,您正在传递一个对象 我已经为您的代码设置了一个演示,该演示已经过调整 值得一提的是,代码示例使用的是较旧版本的alertify 0.3,并且已经更新,因此版本1的语法将有所调整