title: How to open bootstrap modal in ajax success
body: <p>I want to open bootstrap modal through jquery. I know ajax in running to success as it throws alerts. But cannot open modal. These are my code.</p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: "&lt;?php echo base_url() . 'index.php/application/requestCode'; ?&gt;",
      data: {
          'apiName': apiName,
          'api': api,
          'hotel': hotel,
          'payment':payment,
          'template': template
      },
      success: function(msg)
      {
          $("#getCodeModal").modal("toggle");
          $("#getCode").html(msg);
      }
  });
  </code></pre>
  
  <p>And my modal HTML is:</p>
  
  <pre><code> &lt;!-- Modal --&gt;
   &lt;div class="modal fade" id="getCodeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
     &lt;div class="modal-dialog modal-lg"&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; API CODE &lt;/h4&gt;
         &lt;/div&gt;
         &lt;div class="modal-body" id="getCode" style="overflow-x: scroll;"&gt;
            //ajax success content here.
         &lt;/div&gt;
      &lt;/div&gt;
     &lt;/div&gt;
   &lt;/div&gt;
  </code></pre>
  
  <p>In error in console: modal is not a function.</p>