Ensure DOM is loaded before binding the global AJAX error handler.

This commit is contained in:
Alex Tselegidis 2020-12-02 20:08:28 +02:00
parent e7b4aeedab
commit 88028d5770

View file

@ -25,9 +25,11 @@ window.GeneralFunctions = window.GeneralFunctions || {};
/** /**
* Register global error handler. * Register global error handler.
*/ */
document.addEventListener('DOMContentLoaded', function() {
$(document).ajaxError(function (event, jqxhr, settings, thrownError) { $(document).ajaxError(function (event, jqxhr, settings, thrownError) {
GeneralFunctions.ajaxFailureHandler(jqxhr, settings, thrownError); GeneralFunctions.ajaxFailureHandler(jqxhr, settings, thrownError);
}); });
});
/** /**
* This functions displays a message box in the admin array. It is useful when user * This functions displays a message box in the admin array. It is useful when user