diff --git a/themes/bootstrap3/js/check_item_statuses.js b/themes/bootstrap3/js/check_item_statuses.js index 0aeec0d860ad510de4fcb9fed2fdeee818c723a5..04dec21f4a7821ac3b15f5c275195a10892ca0ef 100644 --- a/themes/bootstrap3/js/check_item_statuses.js +++ b/themes/bootstrap3/js/check_item_statuses.js @@ -80,9 +80,10 @@ function checkItemStatuses() { $(".ajax-availability").removeClass('ajax-availability'); }) .fail(function(response, textStatus) { - if (textStatus == "abort") { return; } + $('.ajax-availability').empty(); + if (textStatus == 'abort' || typeof response.responseJSON === 'undefined') { return; } // display the error message on each of the ajax status place holder - $(".ajax-availability").empty().append(response.responseJSON.data).addClass('text-danger'); + $('.ajax-availability').append(response.responseJSON.data).addClass('text-danger'); }); } diff --git a/themes/bootstrap3/js/openurl.js b/themes/bootstrap3/js/openurl.js index 638c6373b5a6875910ce3a1b912706381e24ec5a..88f50d1dbd4b5937f35c498d7f2925fcc76226d2 100644 --- a/themes/bootstrap3/js/openurl.js +++ b/themes/bootstrap3/js/openurl.js @@ -11,9 +11,9 @@ function loadResolverLinks($target, openUrl, searchClassId) { $target.removeClass('ajax_availability').empty().append(response.data); }) .fail(function(response, textStatus) { - if (textStatus == "abort") { return; } - $target.removeClass('ajax_availability').addClass('text-danger') - .empty().append(response.responseJSON.data); + $target.removeClass('ajax_availability').addClass('text-danger').empty(); + if (textStatus == 'abort' || typeof response.responseJSON === 'undefined') { return; } + $target.append(response.responseJSON.data); }); } diff --git a/themes/bootstrap3/js/record.js b/themes/bootstrap3/js/record.js index b57f6b22fa925e143e279b27fcf766c086061f52..6ed8710bde7576b2bd61dc14bb3983bd99f6b6e5 100644 --- a/themes/bootstrap3/js/record.js +++ b/themes/bootstrap3/js/record.js @@ -96,7 +96,7 @@ function registerAjaxCommentRecord() { $(form).find('input[type="submit"]').button('loading'); }) .fail(function(response, textStatus) { - if (textStatus == "abort") { return; } + if (textStatus == 'abort' || typeof response.responseJSON === 'undefined') { return; } Lightbox.displayError(response.responseJSON.data); }); return false;