Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.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
Php CKeditor内联编辑,获取元素类_Php_Jquery_Html_Ajax_Ckeditor - Fatal编程技术网

Php CKeditor内联编辑,获取元素类

Php CKeditor内联编辑,获取元素类,php,jquery,html,ajax,ckeditor,Php,Jquery,Html,Ajax,Ckeditor,因此,我尝试将CKeditor与内联编辑结合使用,并找到了一个插件,该插件将CKeditor元素的当前数据发送到ajax脚本,然后ajax脚本将数据发送到php脚本以进行保存。但是,由于每个页面上都需要多个编辑器实例,因此我需要将编辑器实例的id与数据一起发送。这些是我的文件: index.php <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <t

因此,我尝试将CKeditor与内联编辑结合使用,并找到了一个插件,该插件将CKeditor元素的当前数据发送到ajax脚本,然后ajax脚本将数据发送到php脚本以进行保存。但是,由于每个页面上都需要多个编辑器实例,因此我需要将编辑器实例的id与数据一起发送。这些是我的文件:

index.php

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CKeditor test</title>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
</head>
<body>
    <div class="content">
        <div class="editable" contenteditable="true">
            Hello there my friend.
        </div>
    </div>

    <script type="text/javascript">
    window.onload = function()
    {
        CKEDITOR.disableAutoInline = true;
        CKEDITOR.inline( '.editable' )
    }
    </script>
</body>
</html>

如何才能做到这一点?

我也有同样的问题

您可以这样做,因为您已经拥有内联编辑器正在处理的元素:

data: {
  editabledata: data,
  id: element.attr('id')
}

然后在dump.php的传入请求中有2个POST值,您可以通过以下方式获得元素的Id:

editor.container.getId()
editor.container.getId()