json中换行问题
2014-03-26 14:53 yangzaizai 阅读(1060) 评论(0) 收藏 举报json中不能存在换行,但可以进行替换后给服务器
function(text_info)
{
text_info=text_info.replace(/\r/gm,"<br\>")
text_info=text_info.replace(/\n/gm,"<br\>")//进行替换
text_info = JSON.parse(text_info)
console.log(text_info)
//alert(text_info)
text = text_info["text"]
text=text.replace(/<br\>/gm, "\n")//反替换
text_style = text_info["style"]
}
浙公网安备 33010602011771号