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,8 +25,10 @@ window.GeneralFunctions = window.GeneralFunctions || {};
/**
* Register global error handler.
*/
$(document).ajaxError(function (event, jqxhr, settings, thrownError) {
GeneralFunctions.ajaxFailureHandler(jqxhr, settings, thrownError);
document.addEventListener('DOMContentLoaded', function() {
$(document).ajaxError(function (event, jqxhr, settings, thrownError) {
GeneralFunctions.ajaxFailureHandler(jqxhr, settings, thrownError);
});
});
/**