1

I want to send the value of the wymeditor field with ajax.
The code is like below;

$.ajax({
    type: "POST",
    url: "forms.php",
    cache: false,
    dataType: "html",
    data: {action: 'add', parent: $('input.parent').val(), ntag: $('input.tag').val(), description: $('.wymeditor').html()},
});

I tried for the value of textarea wym.val() / $('.wymeditor').html()
but ajax sends nothing as parameter.
How can I send the value of textarea with ajax?

Thanks.

4

2 回答 2

2

您需要xhtml()在 WYMeditor 实例上调用该方法,而不是在 textarea 本身上。假设您只有一个 wymeditor,并且它是页面上的第一个:

$.ajax({
    type: "POST",
    url: "forms.php",
    cache: false,
    dataType: "html",
    data: {
        action: 'add', 
        parent: $('input.parent').val(), 
        ntag: $('input.tag').val(), 
        description: $.wymeditors(0).xhtml()
    },
});
于 2012-03-02T21:46:32.033 回答
1

试试这个并将测试变量传递给ajax

 var test = $('textarea#wymeditor').val();
于 2012-03-02T06:14:52.327 回答