I am creating a system of attendance where there is a screen only to display the passwords that are being registered in the database.
The problem is that I can not update the passwords in real time, because I'm calling them from another page, I just managed to get the updates updated every time, I'd like to know if I can do this asynchronously together with ajax.
This is screen code that calls passwords
<script>
$(document).ready(function Att() {
$.ajax({
url: '../SenhaController',
data: 'json',
success: function (data) {
$.each(data.nomeNormal, function (idx, obj) {
$('#tabelaNorm').ready().append("<tr><td>" + obj.nomeNormal + "</td><tr>");
});
$.each(data.nomePref, function (idx, obj) {
$('#tabelaPref').ready().append("<tr><td>" + obj.nomePref + "</td><tr>");
});
}
});
});
</script>
And this is where I register passwords
<script>
$(document).ready(function () {
$('#submit').click(function (event) {
var username = $('#name').val();
var senha = $("input[name='senha']:checked").val();
$.getJSON('../gerarSenha', {user: username, senha: senha}, function (resposta) {
$('#resultado').html(resposta.respostaNormal).fadeIn().delay(1000).fadeOut();
$('#resultado').html(resposta.respostaPref).fadeIn().delay(1000).fadeOut();
$('#name').val('');
});
});
});
</script>
Thank you in advance.