title: How to load image into Bootstrap Modal from JSON Flickr API
body: <p>Below is the code I am working with as an example.
  When I click each image from the Flickr feed I want to be able to load the Bootstrap Modal (which it does) but display that particular photo in the Modal (which it currently doesnt).
  I've tried numerous different things. But I am unable to get it to work.
  Example at <a href="http://jahax.com/ins/" rel="nofollow">http://jahax.com/ins/</a></p>
  
  <pre><code>    &lt;div class="container"&gt;
  
          &lt;h2 style="text-align: center;"&gt;Demonstration&lt;/h2&gt;
          &lt;p class="text-center"&gt;Demo of Bootstrap, jQuery &amp; JSON API&lt;/p&gt;
          &lt;div class="row text-center"&gt;
          &lt;/div&gt; 
          &lt;div id="images" class="row text-center"&gt; &lt;/div&gt;
          &lt;/div&gt;
  
  
  
  
      &lt;div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="nyModalLabel" 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-hidden="true"&gt;&amp;times;&lt;/button&gt;
          &lt;h4 class="modal-title" id="myModalLabel"&gt;Demo of Modal&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          &lt;img id="mimg" src=""&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;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
      &lt;script src="https://code.jquery.com/jquery.js"&gt;&lt;/script&gt;
      &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          // Start jQuery Function
          $(document).ready(function(){                   
  
              // JSON API to access Flickr               
              $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=winter&amp;format=json&amp;jsoncallback=?", displayImages);
  
              function displayImages(data) {                                                                                                                                 
                  var iCount = 0;                             
                  var htmlString = "&lt;div class=row&gt;";                 
  
                  $.each(data.items, function(i,item){
                      if (iCount &lt; 18) {
                          var sourceSquare = (item.media.m).replace("_m.jpg", "_q.jpg");      
  
                          htmlString += '&lt;a class="btn" data-toggle="modal" data-target="#myModal"&gt;';
                          htmlString += '&lt;img src="' + sourceSquare + '"&gt;';
                          htmlString += '&lt;/a&gt;';
                      }
                      iCount++;
                  });     
  
              // HTML into #images DIV
              $('#images').html(htmlString + "&lt;/div&gt;");
  
              // Close down the JSON function call
              }
  
          // End jQuery function  
          });
      &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          // Send Content to Bootstrap Modal
          $('img').on('click',function()
              {
                  var sr=$(this).attr('src'); 
                  $('#mimg').attr('src',sr);
                  $('#myModal').modal('show');
              });
      &lt;/script&gt;
  </code></pre>