title: How to load tinymce text area via ajax
body: <p>I have this tinymce text area which is using Ajax to call it and call the content from the database</p>
  
  <pre><code>&lt;form class="form"&gt;
      &lt;table cellspacing="20"&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;label&gt;Select Page :&lt;/label&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;select name="cms" id="cms" onchange="page_get_content(this.options[selectedIndex].value);"&gt;
                      &lt;option value=""&gt;Select Page to be edited&lt;/option&gt;
                      &lt;option value="3"&gt;Home Page&lt;/option&gt;
                      &lt;option value="1"&gt;About us&lt;/option&gt;
                      &lt;option value="2"&gt;Agents&lt;/option&gt;
                  &lt;/select&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;/td&gt;
              &lt;td&gt;
                  &lt;div id="content" style="display: none;"&gt;
                      &lt;textarea id="newsdesc" name="content"&gt;&lt;/textarea&gt;
                  &lt;/div&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here is the JavaScript that calls it</p>
  
  <pre><code>function page_get_content(id) {
      if (window.XMLHttpRequest) {
          xmlhttp = new XMLHttpRequest();
      } else {
          xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlhttp.onreadystatechange = function () {
          if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
              document.getElementById('content').style.display = "block";
              document.getElementById('newsdesc').innerHTML = xmlhttp.responseText;
          }
      }
      xmlhttp.open('GET', 'forms/cms_get.php?page_id=' + id, true);
      xmlhttp.send();
  }
  </code></pre>
  
  <p>And here is the cms_get.php:</p>
  
  <pre><code>&lt;?php
  $page_id = $_GET['page_id'];
  if(!empty($page_id)){
      $cms = new CMS();
      $page = $cms -&gt; find_by_id($page_id);
      if($page) {
  ?&gt;
  &lt;?php echo $page -&gt; content; ?&gt;
  &lt;?php 
      } 
  } 
  ?&gt;
  </code></pre>
  
  <p>Everything is working fine but the tinymce is loading empty, and when i inspect the element with fire bug i get my text area but it is hidden and i tried to display it as block it is showing me the regular html text area my point is i want to show it with the contents in it</p>