after ajax form submit value from ckeditor textarea is not sent through post

后端 未结 5 1970
鱼传尺愫
鱼传尺愫 2021-02-08 07:30

i have a form having some textfields and a textarea (ckeditor), after onclick button art_title field value is sent to art_save.php page, but value from textarea is not sent.

5条回答
  •  粉色の甜心
    2021-02-08 08:04

    You can force CKeditor to update the textarea value using:

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

    Also, you can use .serialize for the data - then you won't have to maintain the AJAX code if parameters change:

    
    function saveArt() 
    {
        for (instance in CKEDITOR.instances) {
            CKEDITOR.instances[instance].updateElement();
        }
    
        jQuery.ajax({
            type: 'POST',
            url: 'art_save.php',
            data: $("#art").serialize()
         });  
         return false; 
    
     }
    

提交回复
热议问题