经过检测 处理成功:var res=eval("("[{"fid":"3","sid":"3","sonName":"初一化学"},{"content":'<p><img alt="" src="http://list.image.baidu.com/t/image/w_chuangyisheji.jpg" />wwwwrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrqqq</p>'},{"content":'<p>wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww</p>'}]")");经过检测处理失败(没有执行):var res=eval("("[{"fid":"3","sid":"10","sonName":"初四化学"},{"content":'<p><img alt="" src="http://list.image.baidu.com/t/image/w_chuangyisheji.jpg" /></p>'},{"content":'<p><img alt="" src="http://list.image.baidu.com/t/image/w_chuangyisheji.jpg" />dddddddddddddddddddddddddddddddddddddddddd</p><p>sdddddddddddddddddddddddd</p>'}]")");大家看看 ajax返回值的时候用eval处理 第二个为什么会不行呢?
恩谢谢您 刚我试过了
用res=res.replace("\r\n",res); 把它给替换了可是对下面的这一段 依然没有用啊。 为什么?
<p>dfgdfdggdg</p>
<p>erwerwrwe</p>
<p> </p>
<p> </p>
<p>werwerwerweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee</p>
写错了res=res.replace("\r\n","");
你用 \r\n 就删不掉了res = res.replace(/[\r\n]+/g, '');