From 73ed141a5ed12874a92d13dc40289f00af8f18a0 Mon Sep 17 00:00:00 2001 From: Marius Hein Date: Wed, 9 Oct 2013 17:27:47 +0200 Subject: [PATCH] Fix: Allow errors in body to be replaced fixes #4736 --- public/js/icinga/icinga.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/public/js/icinga/icinga.js b/public/js/icinga/icinga.js index 1d2636579..ec3b6a474 100755 --- a/public/js/icinga/icinga.js +++ b/public/js/icinga/icinga.js @@ -76,14 +76,19 @@ define([ href = URI(href); } document.body.pending = $.ajax({ - success: function(domNodes) { - $('body').empty().append(jQuery.parseHTML(domNodes)); - ignoreHistoryChanges = true; - History.pushState({}, document.title, href.href()); - ignoreHistoryChanges = false; - components.load(); - }, url: href.href() + }).done(function(domNodes) { + $('body').empty().append(jQuery.parseHTML(domNodes)); + ignoreHistoryChanges = true; + History.pushState({}, document.title, href.href()); + ignoreHistoryChanges = false; + components.load(); + }).error(function(xhr, textStatus, errorThrown) { + if (xhr.responseText) { + $('body').empty().append(jQuery.parseHTML(xhr.responseText)); + } else if (textStatus !== 'abort') { + logging.emergency('Could not load URL', xhr.href, textStatus, errorThrown); + } }); return false;