我想使用新CKEditor 4(http://docs.ckeditor.com/#!/guide/dev_inline-section-2)的“内联编辑”,但找不到如何使用PHP / MySQL保存数据的任何示例。你能救我吗?
答案 0 :(得分: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>