0

新しい CKEditor 4 ( http://docs.ckeditor.com/#!/guide/dev_inline-section-2 )の「インライン編集」を使用したいのですが、PHP でデータを保存する方法の例が見つかりません。 /MySQL。手伝って頂けますか?

4

1 に答える 1

1

以下は、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>
于 2013-07-03T10:48:10.453 に答える