From c21bf8806a1f34372308dfda5866a5608832b37a Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 4 Jan 2021 10:45:35 +0000 Subject: [PATCH] display answers on a failed sumbit --- js/interact.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/js/interact.js b/js/interact.js index 2fffba3..4101694 100644 --- a/js/interact.js +++ b/js/interact.js @@ -61,7 +61,22 @@ export function postAnswers(ans) { } } else { alert(`Error submitting answers: ${data.error}`); - } - }); - // $.post( "http://localhost:8000/submit_answers", JSON.stringify(ans)); + var docHeight = $(document).height(); + + $("body").append(`

A copy of your answers are displayed below. Please refresh this page to continue.

${ans}
`); + + $("#overlay") + .height(docHeight) + .css({ + 'opacity' : 0.4, + 'position': 'absolute', + 'top': 0, + 'left': 0, + 'background-color': 'black', + 'width': '100%', + 'z-index': 5000 + }); + } + }); + // $.post( "http://localhost:8000/submit_answers", JSON.stringify(ans)); }