Skip to content

Commit

Permalink
add json format check on ajax callback
Browse files Browse the repository at this point in the history
  • Loading branch information
hizzgdev committed Nov 3, 2016
1 parent 6428b35 commit e731819
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/jsmind.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'){
Expand Down

0 comments on commit e731819

Please sign in to comment.