0

I have a sample code:

$content = "";
$wysiwyg = JFactory::getEditor();
$html = $wysiwyg->display('html', $content, '100%', '400px', '', '', array(''));

And Jquery

Joomla.submitbutton = function(pressbutton) {
        if(pressbutton == 'save') {
            jQuery.ajax({
                success: function(data) {
                    jQuery('#html').html('test test test');
                }
            });
        } else {
            submitform(pressbutton);
        }    
}

When I click submit save, text editor can't insert test test test, How to fix it ?

Hai Truong IT
  • 4,126
  • 13
  • 55
  • 102
  • did you try this-http://stackoverflow.com/questions/8740610/how-to-insert-text-to-editor-programaticlly-in-joomla – Irfan Nov 29 '12 at 04:46

2 Answers2

1

jQuery.ajax should like

jQuery.ajax({
  url: 'ajax/test.html',
  success: function(data) {
    jQuery('#html').html('test test test');

  }
});

you are not using the url(page) where to sent data so ajax call wont made and it not successful ajax request

NullPoiиteя
  • 56,591
  • 22
  • 125
  • 143
0

I think you need to work with the tinyMCE object.

There you can access methods like tinyMCE.get() and others.

Check post related to tinyMCE and tinyMCE API

Valentin Despa
  • 40,712
  • 18
  • 80
  • 106