From 928acfdad9fd008575d4c76c2e35e14ee8790659 Mon Sep 17 00:00:00 2001 From: kdepp Date: Thu, 25 Jan 2018 15:21:13 +0800 Subject: [PATCH] fix cs: get config.json --- scripts/cs.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/cs.js b/scripts/cs.js index bdf2057..0ca7414 100644 --- a/scripts/cs.js +++ b/scripts/cs.js @@ -346,7 +346,8 @@ ) .done(function (config, htmlStr) { HTMLSTRCOPY = htmlStr[0]; - OCRTranslator.APPCONFIG = APPCONFIG = JSON.parse(config[0]); + // Note: it seems like with jQuery 3+, $.get (ajax) directly returns a json object if you're loading a json file + OCRTranslator.APPCONFIG = APPCONFIG = typeof config[0] === 'string' ? JSON.parse(config[0]) : config[0]; $dfd.resolve(APPCONFIG, HTMLSTRCOPY); }) .fail(function (err) {