0
I have a step-by-step form from which every step saved in the database the information. In the last step I bring the information saved as follows with jquery:
<script type="text/javascript">
function mostrar(){
$(document).ready(function(){
$.ajax({
type:'post',
dataType: 'json',
url: 'atualizar.php',
success: function(dados){
for(var i=0;dados.length>i;i++){
$('#listar').append(dados[0]);
$('#listar').append(dados[i].id+'</td><td>'+dados[i].nome+'</td><td>'+dados[i].email+'</td></tr>');
}
console.log(dados);
}
});
});
}
setInterval(mostrar, 2000);
</script>
It is working perfectly, but in this case I am updating for 02 seconds the div and I would like to know if it is possible to update only when accessing the div in the last step. HTML is that way:
<fieldset>
<!-- Última etapa do step-by-step -->
<h4>Confirme seus dados:</h4>
<div id="listar"></div>
<form role="form" action="" method="post" id="contact-form">
<div class="f1-buttons">
<button type="button" class="btn btn-previous">Alterar</button>
<button type="button" class="btn btn-primary">Finalizar</button>
</div>
</form>
</fieldset>
define "when to access div"
– Paulo Roberto Rosa
This is that project you were doing?
– Sam
Hello Dvd. That, but there were changes in the course of the project :(
– user24136
Hello Paulo Roberto. Actually it would be to access the last stage where the div I refer is.
– user24136