我在使用 ajax/json 时遇到问题
PHPjson_encode()
生成了这个 json 代码:
[{"createdDate":"2013-08-16 13:23:35","body":"kpk"},
{"createdDate":"2013-08-16 13:20:18","body":"iji"},
{"createdDate":"2013-08-16 13:17:34","body":"kp"},
{"createdDate":"2013-08-16 13:17:16","body":"kp"},
{"createdDate":"2013-08-16 13:15:11","body":"koml"},
{"createdDate":"2013-08-16 13:14:08","body":"lplpp,"},
{"createdDate":"2013-08-16 13:13:59","body":"lplpp,"},
{"createdDate":"2013-08-16 13:10:51","body":"mpmkp"},
{"createdDate":"2013-08-16 13:10:29","body":"ook"},
{"createdDate":"2013-08-16 13:07:48","body":"oomoloo"}]
但是我不断收到意外的令牌错误,有人可以向我解释为什么吗?
当我尝试通过以下方式解析 json 字符串时会引发错误:
function ajax_callback(mex)
{
mexx = JSON.parse(mex);
//other stuff
}