From e73181958065a11cb3449ea9f8dc488d70e8245e Mon Sep 17 00:00:00 2001 From: hizzgdev Date: Fri, 4 Nov 2016 00:00:17 +0800 Subject: [PATCH] add json format check on ajax callback --- js/jsmind.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/jsmind.js b/js/jsmind.js index 8af5b03d..4a800076 100644 --- a/js/jsmind.js +++ b/js/jsmind.js @@ -874,8 +874,12 @@ if(xhr.readyState == 4){ if(xhr.status == 200 || xhr.status == 0){ if(typeof callback === 'function'){ - var data = eval('('+xhr.responseText+')'); - callback(data); + var data = jm.util.json.string2json(xhr.responseText); + if(data != null){ + callback(data); + }else{ + callback(xhr.responseText); + } } }else{ if(typeof fail_callback === 'function'){