Reputation: 1
I want to use "inline edit" of the new CKEditor 4 (http://docs.ckeditor.com/#!/guide/dev_inline-section-2), but can not find any example of how to save the data with PHP / MySQL. Can you help me?
Upvotes: 0
Views: 1962
Reputation: 13535
Below is a example on how to pass data from the Ckeditor. By pressing the button you can save the content via 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>
Upvotes: 1