2017-08-12 104 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)'可行!謝謝! –