-
In the registration form, I call a
modal
window which is the same page as the list of registered items. -
When I click on
submit
ofform
it sends to my database beauty and closesmodal
.
However, for me to see the change on the screen, it is necessary to give refresh
on the page. How can I click the submit
and at the same time give refresh
to the page?
I tried this way, but was giving% direct%!
<script type="text/javascript">
var timeout = setTimeout("location.reload(true);",2000);
function resetTimeout() {
clearTimeout(timeout);
timeout = setTimeout("location.reload(true);",2000);
}
</script>
<button type="submit" class="btn btn-default" onclick="resetTimeout()">Cadastrar</button>
<!--Butao adicionar -->
<button href="#my-modal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">+ Adicionar</button>
<!-- 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">Adicionar Gás </h4>
</div>
<div class="modal-body">
<form method="post" action="" id="quick-post-form" enctype="multipart/form-data">
<div class="form-group">
<label>Nome</label>
<input class="form-control" name="Nome">
</div>
<div class="form-group">
<label>Preço</label>
<input class="form-control" name="preco">
</div>
<div class="form-group">
<label> </label>
</div>
<div class="form-group">
<label>Imagem</label>
<input type="file" name="image-uploader" id="img-upload">
<img height="80" width="80" id="image-preview" src="" style="display:none;">
<input type="hidden" name="operacao" value="normal">
</div>
<div class="form-group">
<label></label>
</div>
<button type="submit" class="btn btn-default">Enviar</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->