2
Dear colleagues.
I am wanting to pass the values coming from mysql database to bootstrap modal and after some searches,I found the code below:
<a href='#myModal' data-id-pergunta='<?php echo $jm->IdCodFotos; ?>' type="button" class="btn btn-success" data-toggle="modal" title="Alterar sua foto">Alterar</a>
Javascript:
$('#myModal').on('show.bs.modal', function(e) {
var idPergunta = $(e.relatedTarget).data('id-pergunta');
$(e.currentTarget).find('input[name="perguntaId"]').val(idPergunta);
});
Modal:
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Alterar Foto</h4>
</div>
<div class="modal-body">
<input type="text" id="perguntaId" name="perguntaId" class="form-control" value="">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
But unfortunately it’s not working!
I am trying to update using this code: $('#myModal'). on('Hidden.bs.modal',Function(){ Location.Reload(); }); !
– user24136