From 67f388431548d297dcec22ff8e7257f3e6acb481 Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Tue, 9 Mar 2021 23:25:36 +0300 Subject: [PATCH] add processing of errors in response (timeout, server error, expired session, etc.) --- media/com_jedchecker/js/script.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/media/com_jedchecker/js/script.js b/media/com_jedchecker/js/script.js index 2dbadf3..f5ce430 100644 --- a/media/com_jedchecker/js/script.js +++ b/media/com_jedchecker/js/script.js @@ -38,6 +38,18 @@ function check(url, rule) { var success = target.find('.alert-success').length; sidebar.find('.badge.bg-success').toggleClass('hidden', !success); + sidebar.find('.spinner-border').addClass('hidden'); + }, + error: function(xhr, status){ + var sidebar = jQuery('#jed-' + rule); + var target = jQuery('#police-check-result-' + rule); + + target.html('' + status + ': ' + xhr.status + ' ' + xhr.statusText + ''); + + sidebar.find('.badge.bg-danger').text('?'); + sidebar.find('.badge.bg-warning,.badge.bg-secondary,.badge.bg-info').text(''); + sidebar.find('.badge.bg-success').addClass('hidden'); + sidebar.find('.spinner-border').addClass('hidden'); } });