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.
You need to be calling the xhtml()
method on your WYMeditor instance and not on the textarea itself. Assuming you only have one wymeditor, and it's the first on the page:
$.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()
},
});