title: Load a bootstrap modal through ajax - PHP
body: <p>I want to load a modal using ajax, here's my code : </p>
  
  <pre><code>jQuery(document).ready(function() {
  jQuery("a").click(function() {
  var Id = jQuery(this).attr("id");
          jQuery.ajax({
          type: 'POST',
          data: {
              'modal_id' : Id,
          },
  
          url : "ajax.php",
          success: function(reponse) {
              if(reponse) {
                  alert(reponse);
              } else {
                  alert('Error');
              }
          }
           });
  });
  });
  </code></pre>
  
  <p>And here's my <code>{a}</code> tag :</p>
  
  <pre><code>&lt;a id="2" data-original-title="Preview" data-placement="top" class="data-tooltip" rel="tooltip" data-toggle="modal" href="#modal_2"&gt;&lt;span class="btn btn-default btn-sm glyphicon glyphicon-new-window"&gt;&lt;/span&gt;&lt;/a&gt;
  </code></pre>
  
  <p><br>ajax.php :</p>
  
  <pre><code>echo "&lt;div class='modal fade' id='modal_".$_POST['modal_id']."'&gt;
          &lt;div class='modal-dialog'&gt;
              &lt;div class='modal-content'&gt;
                  &lt;div class='modal-header'&gt;
                      &lt;button type='button' class='close' data-dismiss='modal' aria-hidden='true'&gt;&amp;times;&lt;/button&gt;
                      &lt;h4 class='modal-title'&gt;Preview&lt;/h4&gt;
                  &lt;/div&gt;
                  &lt;div class='modal-body'&gt;";
  
                  echo "&lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;";
  </code></pre>
  
  <p>How I can display the modal through ajax and why my code doesn't work? Thanks.</p>