Fix: Allow errors in body to be replaced

fixes #4736
This commit is contained in:
Marius Hein 2013-10-09 17:27:47 +02:00
parent a1ac44362f
commit 73ed141a5e
1 changed files with 12 additions and 7 deletions

View File

@ -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;