1
<script type="text/javascript">
$(document).ready(function(){
    $("#btnUpdate").click(function(){
        alert($("#frm_data").serialize());
        var formData = new FormData($("#frm_data")[0]);
        var Desc= CKEDITOR.instances.editor1.getData();

        $("#btnUpdate").attr('value', 'Please Wait...');
        $.ajax({
            url: 'update_job.php',
            data: formData,
            cache: false,
            contentType:false,
            processData:false,
            type: 'post',
            success: function(response)
            {
                $("#btnUpdate").attr('value', 'Update');
            }
        });
        return false;
    });
})
</script>

i use ckeditor for textarea field. but its can update value with new value, so i want to use another way with send textarea value with form data.
so how to send Desc data with fromData. in ajax.

1 Answer 1

1

To achieve this you can use the append() method of FormData to add whatever additional information you require:

$("#btnUpdate").click(function(e) {
    e.preventDefault();
    var $btn = $(this).attr('value', 'Please Wait...');
    var formData = new FormData($("#frm_data")[0]);
    formData.append('desc', CKEDITOR.instances.editor1.getData());

    $.ajax({
        url: 'update_job.php',    
        data: formData,
        cache: false,
        contentType: false,
        processData: false,
        type: 'post',
        success: function(response) {    
            $btn.attr('value', 'Update');
        }
    });
});
Sign up to request clarification or add additional context in comments.

2 Comments

var formData = new FormData($("#frm_data")[0]); var data = CKEDITOR.instances.editor1.getData(); formData.append('desc',data);
That would work too. Are you having problems with it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.