tiny mce update in ajax

Discussion in 'PHP' started by pratip, Jun 8, 2010.

  1. #1
    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);
    					 }
    				}
    			});
    		}
    
    
    Code (markup):
    "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...
     
    pratip, Jun 8, 2010 IP
  2. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #2
    Hmmm...
    Oops TinyMCE JS is too Complicated and heavy to understand for me!
    Better you can have a look in their forums for it
     
    roopajyothi, Jun 8, 2010 IP
  3. pratip

    pratip Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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.
     
    pratip, Jun 9, 2010 IP
  4. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #4
    Umm...
    Happy t know that you solved that
    BTW: I am just get into TinyMCE but i love that CKeditior which is even similar to that :)
     
    roopajyothi, Jun 9, 2010 IP
  5. pratip

    pratip Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yes, CKeditor is perhaps the extension of FCK and has a great look and feel. But i already implemented tintmce in all parts of my projects. So it should have been a real hard ROLLBACK .. ;)
     
    pratip, Jun 9, 2010 IP
  6. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #6
    Oh! But Ckeditor seems to have good community!
     
    roopajyothi, Jun 9, 2010 IP
  7. pratip

    pratip Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Does CKeditor provides good plugins like FCK or TinyMCE??
     
    pratip, Jun 9, 2010 IP
  8. webria

    webria Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    If you use Firebug to see if the tinyMCE.get('body').setContent('helo'); works/sets the value fine.
    It is needed to know whether we set the value by the above methods. If yes then it should work in ajax.
     
    webria, Jun 9, 2010 IP
  9. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #9
    Oops! really i don't know about that!
    Seems it have all the things that a human need to publish a HTML Page in Web :)
     
    roopajyothi, Jun 9, 2010 IP