1

I used ACE Editor. I want to get all value from ACE Editor using PHP. How can i get?

I wrote JQuery Ajax code

 $('#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);
                       }
                     });
        });

When this code work, not all the code comes, what can i do? without getlValue() or getSession()

thanks regards

Johnny Willemsen
  • 2,942
  • 1
  • 14
  • 16
natxchill
  • 35
  • 7

1 Answers1

1

I solved.

That's like

$('#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);
                       }
                     });
        });

all you have to do ace.edit('codeArea'); not 'editor'

natxchill
  • 35
  • 7
  • You probably need to edit your question to be more useful to other people, now it simply says that you had mixed up dom node ids, but that is not what title of the post says. Also you can simply use `editor.getValue();` – a user Feb 18 '20 at 18:35