Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/467.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当编辑看到';/&引用;_Javascript_Ckeditor_Ajaxform - Fatal编程技术网

Javascript 当编辑看到';/&引用;

Javascript 当编辑看到';/&引用;,javascript,ckeditor,ajaxform,Javascript,Ckeditor,Ajaxform,我在使用CKEDITOR发送内容时遇到问题, 我正在使用AJAX发送内容 $("form#updateInfo").submit(function(){ $("div#loading").html('<img class="loading" src="img/loading.gif" alt="" />'); var content = CKEDITOR.instances['editor1'].getData(); $.ajax({ ur

我在使用CKEDITOR发送内容时遇到问题, 我正在使用AJAX发送内容

$("form#updateInfo").submit(function(){
    $("div#loading").html('<img class="loading" src="img/loading.gif" alt="" />');
    var content = CKEDITOR.instances['editor1'].getData();  
    $.ajax({
        url: "Sources/Ajax.php?act=updateInfo",
        type: "POST",
        data: "page="+$("input[name=page]").val()+"&content="+content,
        success: function(callback){
            $("div#loading").html('');
            if(callback != "OK"){
                $("span#cke_editor1").addClass("err");
                $("div#loading").html(error(callback));
            }else{
                $("div#loading").html(ok("Successfully update!"));
                $("div.n_error").remove();
                $("span#cke_editor1").removeClass("err");
                $("span#cke_editor1").val("");
            }
        }
    });
    return false;
});
$(“表单#更新信息”).submit(函数(){
$(“div#loading”).html(“”);
var content=CKEDITOR.instances['editor1'].getData();
$.ajax({
url:“Sources/Ajax.php?act=updateInfo”,
类型:“POST”,
数据:“page=“+$”(“输入[name=page]”)。val()+“&content=“+content,
成功:函数(回调){
$(“div#loading”).html(“”);
如果(回调!=“确定”){
$(“span#cke_editor1”).addClass(“err”);
$(“div#load”).html(错误(回调));
}否则{
$(“div#load”).html(确定(“成功更新”);
$(“div.n_错误”).remove();
$(“span#cke_editor1”).removeClass(“err”);
$(“span#cke_editor1”).val(“”);
}
}
});
返回false;
});
您是否看到编辑器内容在变量中: CKEDITOR.instances['editor1'].getData(); 我不明白为什么它不保存所有内容, 因此,我开始调试代码,并且我已经理解了当CKEDITOR看到“/”时会出现中断。 我认为这是魔方,但不是,也许php出了问题, 因此,我删除了CKEDITOR,并尝试使用常规的“textarea”来执行此操作 它的工作很好

示例: 内容:

嘿,伙计们,我今天开了亚历克斯的车,真有趣

编辑的答复: “嘿,伙计们,我要开啤酒”

Textarea的答复: “嘿,伙计们,我今天开了亚历克斯的车,真是太有趣了!"

我对这个故事感到绝望也许你们中的一些人可以帮助我


Thx!

这并不是真正实现POST变量的方法,我认为您可能在混合POST和GET

对于数据格式,请尝试此操作

url: "Sources/Ajax.php?act=updateInfo",
type: "POST",
data: { 
    page: $("input[name=page]").val(),
    content: content
},
success: function(callback){ ... }
如何在后端读取它们?
$\u POST
?如果不是,我怀疑这确实是一个GET/POST问题,并且该值可能会被浏览器或服务器自动转换。如果运行
CKEDITOR.instances['editor1'].getData()会发生什么情况;
在开发者控制台中;您看到完整的文本还是缩短的版本

另外,您使用什么版本的CKEditor?目前更常见的是使用
CKEditor.instances.editor.getData();