如果字符串是JSON,则jQuery.parseJSON()应该返回类型为“对象”的对象,因此您只需使用以下命令检查类型
typeof
var response=jQuery.parseJSON('response from server');if(typeof response =='object'){ // It is JSON}else{ if(response ===false) { // the response was a string "false", parseJSON will convert it to boolean false } else { // the response was something else }}


