【问题标题】:How to get all value from ACE Editor using PHP如何使用 PHP 从 ACE 编辑器中获取所有值
【发布时间】:2020-02-17 09:26:42
【问题描述】:

我使用了ACE Editor。我想使用PHPACE Editor 获得所有价值。怎么获得?

我写了JQuery Ajax代码

 $('#save').click(function(){
            var editor = ace.edit("editor");
            var code = editor.getSession().getDocument().getValue();
                  $.ajax({
                       type: "POST",
                       url: "data.php",
                       data: {'code':code},
                       success: function (data) {
                           console.log(data);
                       }
                     });
        });

当这段代码工作时,并不是所有的代码都来了,我该怎么办?没有getlValue()getSession()

感谢问候

【问题讨论】:

标签: php ajax ace-editor


【解决方案1】:

我解决了。

好像

$('#save').click(function(){
            var editor = ace.edit("codeArea");
            var code = editor.getSession().getValue();
                  $.ajax({
                       type: "POST",
                       url: "data.php",
                       data: {'code':code},
                       success: function (data) {
                           console.log(data);
                       }
                     });
        });

你需要做的只是ace.edit('codeArea'); 而不是'editor'

【讨论】:

  • 您可能需要编辑您的问题以对其他人更有用,现在它只是说您混淆了 dom 节点 ID,但这不是帖子标题所说的。你也可以简单地使用editor.getValue();
猜你喜欢
  • 2012-02-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-06-21
  • 1970-01-01
  • 2014-07-22
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多