I'm working on a system that, by typing the data into the fields it checks through a javascript function if the typed data has already been registered in the database. If true, it blocks the button that opens the register window, if false, it leaves the button free so you can open the registration window. When the data is registered in the invoked window, the function is executed in javascript to save the data and in this same function, the verification function is invoked, so when the register window is closed, the system indicates that the data was registered and blocks the button so that the user does not re-register that same data. The problem is that when I invoke the "function checks" inside the function to save the data it does not work. Here is the snippet of the function that saves the data where it invokes the check function:
var cont = 1;
while (cont != 'E'){
if (document.getElementById(cont+'_leitura') != null){
pesquisarLeitura(cont, "leitura");
cont++;
} else {
cont = 'E';
}
}
$('#abreviacao').val('');
$('#comentario').val('');
CKEDITOR.instances.texto.setData('');
document.getElementById('cadastrarLeitura2').style.display='none';