title: Load a modal dialog with ajax in codeigniter
body: <p>I'm using codeigniter php (MVC framework) and I want to open a modal dialog when clicked a button, but my problem is that my modal appears only in my response network(in preview) and not on my actual screen.</p>
  
  <p>This is my modal.php file on view side.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"&gt;
    &lt;div class="modal-dialog" role="document"&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
          &lt;h4 class="modal-title" id="myModalLabel"&gt;Modal title&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          ...
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
          &lt;button type="button" class="btn btn-primary"&gt;Save changes&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is my controller to point to that view:</p>
  
  <pre><code> public function showmachinelist() {
          $this-&gt;load-&gt;view('monitor/modal');
  
      }
  </code></pre>
  
  <p>And I have this button in js to trigger my ajax:</p>
  
  <pre><code>button_2: "&lt;button type=\"button\" class=\"getid btn btn-default tara\" data-target=\"#myModal\" data-toggle=\"modal\" data-id=\""+ missedEntry.id +"\" &gt;Select&lt;/button&gt;"
  </code></pre>
  
  <p>And this ajax:</p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: "Monitor/showmachinelist",
      data: {'val' : imagename},
      dataType: "text"
      }).done(function(data) {
     console.log("test2");
     }).fail(function() {
  alert( "error" );
  });
  </code></pre>
  
  <p>How I can make show that modal?</p>