diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2022-01-23 17:13:49 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2022-01-23 17:13:49 +0300 |
commit | d4ccff8141cc4325d5ffc8890a7be96c0a7f12e7 (patch) | |
tree | c426dceeaf31822530032382d0b147e2ba0e378b /index.html | |
parent | app.py: fix loginctl output parsing (diff) | |
download | linux-status-d4ccff8141cc4325d5ffc8890a7be96c0a7f12e7.tar.gz linux-status-d4ccff8141cc4325d5ffc8890a7be96c0a7f12e7.zip |
dump exceptions to browser's console
Diffstat (limited to 'index.html')
-rw-r--r-- | index.html | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -64,12 +64,21 @@ h1, .h1 { <script src="js/jquery-3.3.1.min.js"></script> <script src="js/bootstrap.bundle.min.js"></script> <script> +function dump_fail(data) { + console.log('Response code was: ' + data.status + ' ' + data.statusText); + console.log('Response was:\n' + data.responseText); +} + +function get(url, success_callback) { + $.get(url, success_callback).fail(dump_fail); +} + function reboot() { - $.get('reboot'); + get('reboot'); } function shutdown() { - $.get('poweroff'); + get('poweroff'); } function set_hostname(data) { @@ -82,7 +91,7 @@ function set_top(data) { } function refresh_top() { - $.get('top', function(data) { + get('top', function(data) { set_top(JSON.parse(data)); }); } @@ -183,7 +192,7 @@ function set_users(data) { } function refresh_status() { - $.get('status', function(data) { + get('status', function(data) { data = JSON.parse(data); set_hostname(data['hostname']); set_system(data['system']); |