ajax回调函数返回值 处理时eval的问题 苦恼人啊
经过检测 处理成功:
var res=eval(“(“[{“fid”:”3″,”sid”:”3″,”sonName”:”初一化学”},{“content”:’
wwwwrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr8本文来源gao.dai.ma.com搞@代*码(网$
搞代gaodaima码
rrqqq
‘},{“content”:’
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
‘}]”)”);
经过检测处理失败(没有执行):var res=eval(“(“
[{“fid”:”3″,”sid”:”10″,”sonName”:”初四化学”},{“content”:”},{“content”:’
dddddddddddddddddddddddddddddddddddddddddd
sdddddddddddddddddddddddd
‘}]
“)”);
大家看看 ajax返回值的时候用eval处理 第二个为什么会不行呢?
——解决方案——————–
js 的字符串中不能有换行符,如一定要有则需转义