title: Set value to textarea TinyMCE using ajax
body: <p>I have these code that fetch data from database using ajax. So far the data can be display into modal if the input is not tinyMCE such as normal textarea, input or dropdown.</p>
  
  <p><strong>js</strong></p>
  
  <pre><code>&lt;script&gt; 
      jQuery(document).ready(function() {
          if ($("#info").length &gt; 0) {
              tinymce.init({
                  selector: "textarea#info",
                  theme: "modern",
                  height: 300,
                  plugins: [
                      "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
                      "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                      "save table contextmenu directionality emoticons template paste textcolor"
                  ],
                  toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | l      ink image | print preview media fullpage | forecolor backcolor emoticons",
              });
          }
      });  
  
      var get_value = "2";
      $.ajax({
          url: '/getData' ,
          type: "GET",
          dataType: "json",
          data: {"get_value": get_value},
          success: function(data)
          {  
              var ar          = data;    
              var content     = ""; 
  
              for (var i = 0; i &lt; ar.length; i++) 
              { 
                  content        = ar[i]['content'];  
              }    
  
              // temp 1
              $('#info').val(content);
  
              // temp 2
              $('#info').tinyMCE.activeEditor.setContent(content);
  
              // temp 3
              tinymce.get('#info').setContent(content);
  
              // temp 4
              $.getInstanceById("info", tinyMCE.activeEditor.setContent);
  
              // temp 5
              tinyMCE.getInstanceById('info').setContent(content);
  
              $('#modal_info').modal({
                  show: true
              });  
  
          },
          error: function(error){
              console.log("Error:");
              console.log(error);
          }
      });  
  &lt;/script&gt;
  </code></pre>
  
  <p>However, value cannot be send into my TinyMCE textarea inside modal. None of the option works for me. Here's my blade.php code.</p>
  
  <p><strong>blade.php</strong> </p>
  
  <pre><code>&lt;div id="modal_info" class="modal fade bs-example-modal-lg" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" style="display: none;"&gt;
      &lt;div class="modal-dialog modal-lg"&gt;
          &lt;div class="modal-content"&gt;
              &lt;div class="modal-header"&gt;
                  &lt;h4 class="modal-title" id="myLargeModalLabel"&gt;Info&lt;/h4&gt;
                  &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;×&lt;/button&gt;
              &lt;/div&gt;
              &lt;div class="modal-body"&gt; 
  
                  &lt;div class="col-md-12"&gt;
                      &lt;div class="form-group row"&gt;
                          &lt;textarea id="info" name="info" class="form-control info"&gt;&lt;/textarea&gt;
                      &lt;/div&gt;
                  &lt;/div&gt; 
  
              &lt;/div&gt;
          &lt;/div&gt;  
      &lt;/div&gt; 
  &lt;/div&gt; 
  </code></pre>
  
  <p>What am I missing ? How to send the value into tinyMCE textarea ? </p>
  
  <p>Appreciate if someone can help. Thanks.</p>