服务器返回一下字符串
{"state":"true","name":"123"}
小程序上使用
var result = JSON.parse(res.data)
无法解析
直接使用res.data.state一直提示undifine
网友回复:
加个 console.log(res) 不就全看清楚了?
应该不会吧 返回的应该都是json格式吧。 不然你试试eval("("+res.data+")")看看
eval("("+res.data+")")
使用就会报错
WAService.js:3 thirdScriptError
eval is not a function;at pages/index/index onReady function;at api request success callback function
TypeError: eval is not a function
at success (http://767280604.appservice.open.weixin.qq.com/app.js:33:26)
at Object.success (http://767280604.appservice.open.weixin.qq.com/WAService.js:3:7222)
at .<anonymous> (http://767280604.appservice.open.weixin.qq.com/WAService.js:4:20167)
at .<anonymous> (http://767280604.appservice.open.weixin.qq.com/asdebug.js:1:15029)
at http://767280604.appservice.open.weixin.qq.com/WAService.js:3:7222
后端在errorCode.php,pkcs7Encode.php,wxBizdataCrypt.php里面删除BOM头即可!!!