From 34aafedf46c14c3d7dfffaa9be08f1976ed7f2e6 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 18 Sep 2020 16:35:02 -0700 Subject: [PATCH] Synchronize with Etiquette. --- frontends/ycdl_flask/static/js/common.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/frontends/ycdl_flask/static/js/common.js b/frontends/ycdl_flask/static/js/common.js index 349eac6..62b6074 100644 --- a/frontends/ycdl_flask/static/js/common.js +++ b/frontends/ycdl_flask/static/js/common.js @@ -18,15 +18,23 @@ function _request(method, url, callback) if (callback == null) {return;} - if (request.status != 0) - { - response.completed = true; - response.data = JSON.parse(request.responseText); - } response.meta = { "request_url": url, "status": request.status } + if (request.status != 0) + { + response.completed = true; + try + { + response.data = JSON.parse(request.responseText); + response.meta.json_ok = true; + } + catch (exc) + { + response.meta.json_ok = false; + } + } callback(response); }; const asynchronous = true;