ajax传编辑器的内容到php,php端代码不完整

WBOY
Release: 2016-06-23 13:50:17
Original
791 people have browsed it

               var cont=UM.getEditor('myEditor').getContent();		alert(cont);		$.ajax({			type: "POST",			url : 'a.php',			data: 'content='+ cont,			dataType: "html",			async:false,				success: function (data) {				alert(data);			}		})	
Copy after login


以上代码做了二次弹出,但代码完全不一下,到了php端,代码到了字体样式那就断了,不知道怎么会事,




回复讨论(解决方案)

是不是转义字符的原因

是不是转义字符的原因


我不知道呀,如果是转义了,那应该怎么解决


是不是转义字符的原因


我不知道呀,如果是转义了,那应该怎么解决

&是转义了吧,前面插入一个 \ 试试

我是获取编辑器中的内容,编辑器的内容有N多,那怎么转义,

你把 php 收到的内容写到文件里去
在文件里查看

谢谢你们,
 
js中用上了,encodeURIComponent 后就好了,
var cont= encodeURIComponent(UM.getEditor('myEditor').getContent());

其实你
data: {content : cont },

jq 就替你做了

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!