Idontreallywolf Idontreallywolf - 1 year ago 130
HTML Question

CKEditor — EMPTY VALUE (Jquery-Ajax Submit)

I created a website & added CKEditor.. I have a form with 3 normal input fields and then a textarea which is replaced by the CKEditor. But When i submit the form, value of CKEditor isn't showing up.


<form id="pform" method="post">
<input class="poster_name" type="text" name="poster_name" placeholder="Namn">
<input class="title" type="text" name="title" placeholder="Titel">
<input class="subject" type="text" name="subject" placeholder="Ämne">
<textarea name="article" id="editor1"></textarea>
// Replace the <textarea id="editor1"> with a CKEditor
// instance, using default configuration.
<a class="submit_postform">Send</a>


type: 'POST',
data: $('#pform').serialize(),
success: function(data) {

Answer Source

That's because the data from the CKEDITOR "moved" to the textarea only before submitting - so you won't see the content in the textarea using .val(). You can access CKEDITOR directly to get the data:

var editor = CKEDITOR.instances['DOM-ID-HERE'].getData();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download