Retrieve textarea value in form .serialize ()

2

I've always used generic function, but I'm having a problem retrieving the value of textarea . I use a text editor in textarea , the CkEditor .

Here is the function I'm using:

function sendPost(form, action, callback) {
    ajaxRequest == null ? ajaxRequest = null : ajaxRequest.abort();
    if (validateForm($("#" + form))) {
        var msg;
        alert($("#"+form).serialize()); 
        //Utilizei esse alert acima, só para verificar como o POST está indo
        ajaxRequest = $.post("crud/" + action + ".php", $("#" + form).serialize(),
            function (data) {
                dataFromAjaxRequest(data, callback);
            });
    } else {
        $("#dialog_modal_mensagem").dialog("open");
    }
}

The output of alert :

titulo=teste&data=03%2F04%2F2014&texto=
    
asked by anonymous 03.04.2014 / 15:53

1 answer

2

You have to update the fields related to CKEditor, before using serialize :

for ( instance in CKEDITOR.instances )
    CKEDITOR.instances[instance].updateElement();

After that, the CKEDitor field will be populated, and should work.

Reference:

How to ajax-submit a form textarea input from CKEditor?

    
03.04.2014 / 16:03