+ -
当前位置:首页 → 问答吧 → 请教:有关ajax异步取出数据显示问题

请教:有关ajax异步取出数据显示问题

时间:2010-11-22

来源:互联网

我通过ajax技术异步请求一个php文件,根据传入的参数取出一个array集合,
接着用phpjson类把字符给转换成json类型,
获得json["content"]的数据时,
在替换<div id="content"></div>后内容中的加粗,换行标签之间显示出来了,而不显示换行,加粗的效果了,也就是说原本几段的内容都变成一段了

content中的内容是通过ckeditor插件输入的

请教该如何解决?

作者: allen2010lp   发布时间: 2010-11-22

\r\n等在html中没有效果的
你把\r\n之内的换成<br/>

作者: cj205   发布时间: 2010-11-22

我取出的数据在页面上显示的内容格式为:
Steve was founder and Creative Director of HHCL &ndash; the agency voted Campaign&rsquo;s Agency of the Year three times and Campaign&rsquo;s Agency of the Decade in January 2000. This unique award was given because of HHCL&rsquo;s &ldquo;iconoclastic attitude both to the work and the way it does business&rdquo;.<br /><br />HHCL&rsquo;s campaigns included; Tango, Pot Noodle, The AA, Egg, Go, Greenpeace, First Direct, Maxell Tapes, Fuji Film and Danepak Bacon.<br /><br />Prior to HHCL, Steve worked at GGT and WCRS.<br /><br />Post-HHCL, he worked as Executive Creative Director at TBWA/London 2006 - 2008, where he oversaw multi-platform work for clients like Playstation, Adidas, Skittles, Nissan Qashqai, and Elastoplast.<br /><br />In July, 2009, he entered the Hall of Fame of FIAP (Ibero-American Advertising Festival).<br /><br />Steve has won most of the major creative awards, including the D&amp;AD Gold Pencil, the Grand Prix at Cannes, the Grand Prix at the British Television Awards, the President&rsquo;s Award at the Royal Television Society awards, and the President&rsquo;s Award at Creative Circle (twice). But he is far more interested in what&rsquo;s coming up next.<br /><br />Steve has spoken at advertising conferences all around the world &ndash; in the USA, Kenya, South Africa, Thailand, Singapore, Indonesia, Hong Kong, Australia, Ireland, France, Germany, Italy, Austria, Sweden and Holland.<br /><br />&nbsp;In 2008, Steve was one of the founding members of Campaign&rsquo;s Hall of Fame, a list of the 40 most influential people in British advertising over the last 50 years. He was the youngest person on the list by about 5 years !

但换行显示的是标签</br>里面还有其它标签,比如&nbsp;等等, 我想显示的是具体效果,请教~~

作者: allen2010lp   发布时间: 2010-11-22

引用 1 楼 cj205 的回复:

\r\n等在html中没有效果的
你把\r\n之内的换成<br/>


我取出的数据在页面上显示的内容格式为:
Steve was founder and Creative Director of HHCL &ndash; the agency voted Campaign&rsquo;s Agency of the Year three times and Campaign&rsquo;s Agency of the Decade in January 2000. This unique award was given because of HHCL&rsquo;s &ldquo;iconoclastic attitude both to the work and the way it does business&rdquo;.<br /><br />HHCL&rsquo;s campaigns included; Tango, Pot Noodle, The AA, Egg, Go, Greenpeace, First Direct, Maxell Tapes, Fuji Film and Danepak Bacon.<br /><br />Prior to HHCL, Steve worked at GGT and WCRS.<br /><br />Post-HHCL, he worked as Executive Creative Director at TBWA/London 2006 - 2008, where he oversaw multi-platform work for clients like Playstation, Adidas, Skittles, Nissan Qashqai, and Elastoplast.<br /><br />In July, 2009, he entered the Hall of Fame of FIAP (Ibero-American Advertising Festival).<br /><br />Steve has won most of the major creative awards, including the D&amp;AD Gold Pencil, the Grand Prix at Cannes, the Grand Prix at the British Television Awards, the President&rsquo;s Award at the Royal Television Society awards, and the President&rsquo;s Award at Creative Circle (twice). But he is far more interested in what&rsquo;s coming up next.<br /><br />Steve has spoken at advertising conferences all around the world &ndash; in the USA, Kenya, South Africa, Thailand, Singapore, Indonesia, Hong Kong, Australia, Ireland, France, Germany, Italy, Austria, Sweden and Holland.<br /><br />&nbsp;In 2008, Steve was one of the founding members of Campaign&rsquo;s Hall of Fame, a list of the 40 most influential people in British advertising over the last 50 years. He was the youngest person on the list by about 5 years !

但换行显示的是标签</br>里面还有其它标签,比如&nbsp;等等, 我想显示的是具体效果,请教~~

作者: allen2010lp   发布时间: 2010-11-22

先replace掉&nbsp;等
这个是必须的

作者: cj205   发布时间: 2010-11-22

热门下载

更多