我想使用新的 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/