简体   繁体   中英

How to post data on text editor in joomla?

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 ?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM