1
In the registration form I call a window
modal
which is the same page of listing entries.When I click on
submit
ofform
it sends to my beauty database and closes themodal
.
However, for me to see the change on the screen, it is necessary to give a refresh
on the page. How can I click on submit
and at the same time give a refresh
on the page?
I tried it like this, but it kept giving refresh
straightforward!
<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 -->
Just do
location.reload()
after you close the modal.– Diego Souza
How would it look in javascript could give me that strength there ?
– Hemerson Prestes
You said that "when I click on the form’s Ubmit it sends to my database blz and closes the modal.". Where is the code that makes the Submit and closes the modal ?
– Diego Souza
I’ll put it down here
– Hemerson Prestes
It’s for editing and asking your question, young man. And another, it’s not the code you save. That’s the HTML. Where’s the JS ?
– Diego Souza
refresh
in thesubmit
will not help to show what is not yet registered...– ShutUpMagda