Sanjay Panchal Sanjay Panchal - 1 year ago 364
Ajax Question

TinyMCE textarea and post form using ajax

I m using tinyMCE for textareas and POSTing form through AJAX.

But when I m trying to save textarea value, it is taking old values on first click, but it takes updated values on second click.

I have tried using tinyMCE.triggerSave() but it didn't work.

I have also tried tinyMCE.get('myid').getContent(), still it takes old values.

My code is as follows.

$(".submit").live("click", function () {
var f = $(this).parents("form");
var action = f.attr("action");
var serializedForm = f.serialize();
//tinyMCE.triggerSave(); also tried putting here
type: 'POST',
url: action,
data: serializedForm,
async: false,
success: function (data, textStatus, request) {
error: function (req, status, error) {
alert&("Error occurred!");
return false;

Please help, any help would be appreciated

Answer Source

Use this instead of tinymce.triggerSave();

$('#' + 'your_editor_id').html( tinymce.get('your_editor_id').getContent() );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download