我有一个使用ckeditor的textarea
<textarea rows="25" cols="50" id="content" name="content" required="required"></textarea>
<script type="text/javascript">
CKEDITOR.replace( 'content' );
</script>
<input type="submit" name="submit" value="submit" class="submit" />
当我点击提交时,一个名为
的Jquery函数$("body").on("click", "input.submit", function() {
for(instance in CKEDITOR.instances){
CKEDITOR.instances[instance].updateElement();
}
var content = CKEDITOR.instances['content'].getData();
var dataString = 'content='+ content;
if(content==='') {
alert("Please fill all fields");
}
else {
$.ajax({
type: "POST",
url: "transfer/action.php",
data: dataString,
cache: false,
success: function(result){
$(".error").html(result);
},
error:function (xhr, ajaxOptions, thrownError){
$(".error").html(thrownError);
}
});
}
return false;
});
我输入了一些数据......
那是因为有像问答网站 任何开发人员都可以发布与编程相关的内容 问题
当我点击提交按钮时,数据显示在jquery中,但是ajax没有正确地向php发送数据,因为单引号已经由编辑器编码.Ajax拒绝发送单引号数据为什么.. 请帮帮我
答案 0 :(得分:0)
You need to disable encoding of HTML entities on Ckeditor. Then, once you POST your data, you should be good. See more info here...
http://ckeditor.com/forums/CKEditor-3.x/Trying-disable-html-entities-not-working