Show an error message if tab loading fails

This commit is contained in:
Eelco Dolstra 2013-02-22 14:17:14 +01:00
parent 47d2ee0dab
commit 961feedf4e

View file

@ -461,7 +461,11 @@ BLOCK makeLazyTab %]
var pattern = /#.+/gi;
var id = e.target.toString().match(pattern)[0];
if (id == "#[% tabName %]") {
$('#[% tabName %]').load("[% uri %]");
$('#[% tabName %]').load("[% uri %]", function(response, status, xhr) {
if (status == "error") {
$('#[% tabName %]').html("<div class='alert alert-error'>Error loading tab: " + xhr.status + " " + xhr.statusText + "</div>");
}
});
}
});
});