2017-08-12 48 views
0

在我的应用程序需要抛出一些误差修改,所以继documentation我可以抛出一些错误与自定义消息和/或通过使用下面的代码会导致某些部分:十月CMS |如何关闭闪光灯消息或警报

throw new AjaxException([ 
    '#error_box' => Lang::get('xxx.xxxx::lang.frontend.error_ajax_und') 
]); 

的问题是,我看到“默认文本”的提示信息,我不知道如何把它关掉...

enter image description here

调试模式禁用

十月身材:419

+0

'$(window).on('ajaxErrorMessage',..'不工作 –

回答

2

在理论上可以挂接到ajaxSetup事件禁用闪存的错误处理:

$(document).on('ajaxSetup', function(event, context) { 
    // Disable AJAX handling of Flash messages on all AJAX requests 
    context.options.flash = false 
}) 

$(document).on('ajaxSetup', function(event, context) { 
    // Handle Error Messages with a custom handler 
    context.options.handleErrorMessage = function(message) { 
     // do stuff 
    } 

    // Handle Flash Messages with a custom handler 
    context.options.handleFlashMessage = function(message, type) { 
     // do stuff 
    } 
}) 
http://octobercms.com/docs/ajax/javascript-api#global-events-examples

沿东西线

+0

'cont ext.options.flash = false'不会给出结果,但'context.options.handleErrorMessage = function(message)'可行!谢谢! –