I am trying to create a page with a list of names. Each name has there own modal(Note: this is in a for loop, so for each name, create a modal) which contains the Name, Description, and an image. The name and title appear, but not the image.
<!-- Toggle Button -->
{% for name in User_list %}
<li><a data-toggle="modal" data-id="{{ name }}" data-description="{{ name.description }}" data-image="{{ name.image }}" title="Add this item" class="open-AddBookDialog " href="#addBookDialog">{{ name }}</a></li>
{% endfor %}
<!-- Modal -->
<div class="modal hide fade" id="addBookDialog">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h3 id="nameId" /></h3>
</div>
<div class="modal-body">
<p id="nameDescription" /></p>
<div id='images'></div>
</div>
</div>
<!-- JavaScript -->
<script type="text/javascript">
$(document).on("click", ".open-AddBookDialog", function () {
var myNameId = $(this).data('id');
var myNameDescription = $(this).data('description');
var thumb = $(this).data('image');
$(".modal-header #nameId").html( myNameId );
$(".modal-body #nameDescription").html( myNameDescription );
$(".modal-body #images").html("<img>" ,{src: thumb});
//.html( myNameImage )
// As pointed out in comments,
// it is superfluous to have to manually call the modal.
});
</script>
What am I doing wrong, and how do I correct it(Note: I am using Twitter-Bootstrap)