I'm trying to submit a form contained in modal boostrap, but I'm not sure how to do this.
See below my code:
Home Page:
<div id="idDivModal4" class="modal fade">
<div class="modal-dialog modal-lg">
<div class="modal-content">
</div>
</div>
</div>
<a class="btn btn-block btn-primary top10 btn-sm" href='#idDivModal4' role='button' data-toggle='modal' data-load-remote='atualizar-status/<?php echo $codigo;?>' data-remote-target='#idDivModal4 .modal-content' aria-hidden='true' > Atualizar Status</a>
Page (update-status) containing modal form:
<div class="modal-body">
<select name="campo_status " id="campo_status " class="form-control div-campo-status" required>
<option value="Sim">Sim</option>
<option value="Não">Não</option>
</select>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">Cancelar</button>
<a class="btn-atualizar-status">Atualizar</a>
</div>
On the Main page, include the following jquery:
$('#idDivModal4').on('click', '.btn-atualizar-status', function(){
{
var campo_status = $(this).parent().find('.div-campo-status').val();
alert(campo_status);
});
It turns out that it triggers the click event, however, when you click the button, it shows the variable as "undefined". How can I retrieve the value of the select field?
Any help thank you = D