简体   繁体   English

如何在joomla中的文本编辑器上发布数据?

[英]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 和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 ? 当我单击“提交保存”时,文本编辑器无法插入test test test ,如何解决?

jQuery.ajax should like jQuery.ajax应该喜欢

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 您没有在发送数据的位置使用url(page),所以不会进行ajax调用,因此ajax请求不会成功

I think you need to work with the tinyMCE object. 我认为您需要使用tinyMCE对象。

There you can access methods like tinyMCE.get() and others. 在这里,您可以访问诸如tinyMCE.get()等方法。

Check post related to tinyMCE and tinyMCE API 查看与tinyMCE和tinyMCE API相关的帖子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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