diff --git a/app/assets/javascripts/app/lib/app_post/ajax.js.coffee b/app/assets/javascripts/app/lib/app_post/ajax.js.coffee index b844ed714..6161b1685 100644 --- a/app/assets/javascripts/app/lib/app_post/ajax.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/ajax.js.coffee @@ -2,11 +2,11 @@ class App.Com _instance = undefined # Must be declared here to force the closure on the class @ajax: (args) -> # Must be a static method if _instance == undefined - _instance ?= new _Singleton + _instance ?= new _ajaxSingleton _instance.ajax(args) # The actual Singleton class -class _Singleton +class _ajaxSingleton defaults: contentType: 'application/json' dataType: 'json' @@ -33,7 +33,7 @@ class _Singleton ) # show error messages - $('body').bind( 'ajaxError', ( e, jqxhr, settings, exception ) -> + $(document).bind( 'ajaxError', ( e, jqxhr, settings, exception ) -> status = jqxhr.status detail = jqxhr.responseText if !status && !detail @@ -45,6 +45,9 @@ class _Singleton # do not show any error message on wrong login return if status is 422 + # do not show any error message with code 200 + return if status is 200 + # show human readable message if status is 401 status = 'Access denied.'