I'm not sure what I'm doing wrong, but I've searched in all "passing data to a bootstrap modal" posts, but still can't find the answer.
I have a table with users. In each row there is a "delete user button". When you click on "delete", a modal shows up which the legend: "Are you sure you want to delete?"
I want the username to be displayed in that legend, so I send the username to a JS file but it doesn't show. Nothing appears.
This is the delete button in every row:
<td><a href="#" onclick="callToModal({$frontuser->username});return false;" class="btn mini red-stripe" role="button" >Delete</a></td>
I'm using smarty that's why the parameter looks like this: {$frontuser->username}
Above that code, I have the definition of the modal:
<!-- modal -->
<div id="myModal3" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel3" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h3 id="myModalLabel3"></h3>
</div>
<div class="modal-body">
<p></p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cerrar</button>
<button data-dismiss="modal" class="btn blue" id="deleteok">Confirmar</button>
</div>
</div>
<!-- end modal -->
Then my JS file is:
function callToModal(data) {
$("#myModal3 .modal-header h3").html("Eliminar");
$("#myModal3 .modal-body p").html("Are you sure you want to delete: ", data);
$("#myModal3").modal("show");
}
Any help would be much appreciated!