ajax回调函数返回值 处理时eval的有关问题 苦恼人

WBOY
Release: 2016-06-13 12:58:54
Original
940 people have browsed it

ajax回调函数返回值 处理时eval的问题 苦恼人啊
经过检测 处理成功:

var res=eval("("[{"fid":"3","sid":"3","sonName":"初一化学"},{"content":'

 ajax回调函数返回值 处理时eval的有关问题 苦恼人 wwwwrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrqqq

'},{"content":'

wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww

'}]")");



经过检测处理失败(没有执行):var res=eval("("

[{"fid":"3","sid":"10","sonName":"初四化学"},{"content":'

 ajax回调函数返回值 处理时eval的有关问题 苦恼人

'},{"content":'

 ajax回调函数返回值 处理时eval的有关问题 苦恼人 dddddddddddddddddddddddddddddddddddddddddd



sdddddddddddddddddddddddd

'}]

")");



大家看看 ajax返回值的时候用eval处理  第二个为什么会不行呢?

------解决方案--------------------
js 的字符串中不能有换行符,如一定要有则需转义
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template