title: TinyMCE with Ajax: How to return POST response to display in TinyMCE?
body: <p>So, I can send a Post to my PHP program and it can send a response to a div on my HTML page. However, what I want to do is have this response display in the TinyMCE editor and NOT in the div area. How do I adapt my code to do that?</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;
          &lt;title&gt;getdata&lt;/title&gt;
          &lt;script type="text/javascript" src="tinymce/js/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="tinymce/plugin/tinymce/tinymce.min.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript" src="tinymce/plugin/tinymce/init-tinymce.js"&gt;&lt;/script&gt;
          &lt;script type="text/javascript"&gt;
      function post()
      {
      tinyMCE.triggerSave();
      var documentx= $('#texteditor').val();
      $.post('validate.php',{postdocument:documentx},
          function (data) 
          {
           $('#data-container').html(data);
          } );
      }   
  &lt;/script&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;form id="get-data-form" method="post"&gt;
              &lt;textarea class="tinymce" id="texteditor"&gt; &lt;/textarea&gt;
              &lt;input type="button" value="submit" onclick="post();" /&gt;    
          &lt;/form&gt;
  
  
  &lt;div id="data-container"&gt; &lt;/div&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>