Tiny mce update in ajax

Hello everybody,

I’m not able to update a tiny mce text editor content in ajax (using php). Weirdly, if i update any div, it performs perfectly, but not in the case of the editor. I’m confused as to what i’m doing wrong here. Can you guys please help me?

This is my code…


if($("body") && go_url)
		{
			tinyMCE.triggerSave();
			var xmlHttp= new Ajax.Updater("body",go_url,
			{
				parameters:Form.serialize('import_but'),
				onLoading:function(){loading_in();},
				onLoaded:function(){loading_out();},
				onComplete:function(request)
				{
					if(xmlHttp.responseIsFailure(  ))
					{
					    alert('failed');
					}
					else
					{
                        tinyMCE.get('body').setContent(request.responseText);
					 }
				}
			});
		}

“body” is the id of the text area (that is converted into the tiny mce instance).
Again, I tested with a normal, plain div and it worked fine, but not with the editor.

Am i doing anything wrong???

Please help…

Never mind, i found out the problem. It’s just that the else part of the oncomplete state was not working for some reason. When i place the editor update code outside the if-else checking, it worked.