简体   繁体   中英

Using a TinyMCE textarea and posting form using ajax

I m using tinyMCE for textareas and posting my form through AJAX. But when I m trying to save textarea value, the value in the text area is not being recorded.

My text area <textarea class="form-control" name="content" id="input"></textarea>

and my ajax code

var formData = {
        'flashcard_title'           : $('input[name=flashcard_title]').val(),
        'flashcard_id'              : $('input[name=flashcard_id]').val(),
        'content'                   : $('textarea[name=content]').val(),

    $.ajax({
        type        : 'POST', 
        url         : 'slides',
        data        : formData, 
        dataType    : 'json', 
        encode      : true
    })

Please help. Thanks guys

This seems broken:

var formData = {
    'flashcard_title'       : $('input[name=flashcard_title]').val(),
    'flashcard_id'          : $('input[name=flashcard_id]').val(),
    'content'               : $('textarea[name=content]').val(),

Try deleting that final , and adding the missing brace } at the end.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM