php - 如何在 CKEditor saving 中使用内联编辑保存、删除、编辑数据到 PHP/Mysql?

标签 php html mysql ajax ckeditor

我想使用新的 CKEditor 4 ( http://docs.ckeditor.com/#!/guide/dev_inline-section-2 ) 的“内联编辑”,但找不到任何如何使用 PHP/MySQL 保存数据的示例。你能帮我吗?

最佳答案

下面是如何从 Ckeditor 传递数据的示例。通过按下按钮,您可以通过ajax保存内容。

<div id="editable" contenteditable="true">
    <h1>Inline Editing in Action!</h1>
    <p>The div element that contains this text is now editable.
</div>
<button type='button' id='save'><span>Save</span></button>

<script>

   $(document).ready(function (e) {

      $("#save").click(function (e) {
          var data = CKEDITOR.instances.editable.getData();
          var options = {  
               url: "/path/to/php",
              type: "post",
              data: { "editor" : encodeUriComponent(data) },
             success: function (e) {
                 //code to do when success
             }

           };
      }
   });
</script>

关于php - 如何在 CKEditor saving 中使用内联编辑保存、删除、编辑数据到 PHP/Mysql?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17445749/

相关文章:

php - 在 laravel 中 save() 之后发送模型以查看 id

php - 从文本文件中读取一行,然后将其删除

php - 跳过 fgetcsv 方法的第一行

php - php 中的问题 "header"

html - 站点依赖项和 CSS 未加载

html - 用 flexbox 包装内联嵌套列表

php - MySQL 按小时计算 DATETIME 条目

php - 如果未获取任何行,则 Codeigniter row_array 内容

javascript - HTML5音频播放器可以播放多首歌曲吗

jquery - 无法在移动设备上使用线性背景