From e40fb640e2703b4311069e2810f2394e86440c67 Mon Sep 17 00:00:00 2001 From: baxiry Date: Sat, 12 Oct 2024 23:33:18 +0300 Subject: [PATCH] fix rendering data bug --- static/shell.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/static/shell.js b/static/shell.js index c501fa7..269a473 100644 --- a/static/shell.js +++ b/static/shell.js @@ -62,21 +62,24 @@ queryInput.addEventListener('keydown', function(event) { // render response data function HandleResponse(response) { - $('#examples').hide(); + $('#examples').html("
"); $('#data').html("
"); - if (response == "") { + //$("#data").remove(); + + if (response === "") { $('#data').html(`
null
`); $('#data').fadeIn(400); return; } if (pretty) { - let Data = prettyJSON(response) - $('#data').html(`
${Data}
`); + let data = prettyJSON(response) + $('#data').html(`
${data}
`); + $('#data').fadeIn(400); return; } - data = JSON.parse(response); + let data = JSON.parse(response); if (!Array.isArray(data)) { let obj = JSON.stringify(data) $('#data').append(`
${obj}
`);