Problems with a function calling another function in javascript

Asked

Viewed 58 times

0

I am working on a system that, when entering the data in the fields it checks through a javascript function if the data entered has already been registered in the database. If true, it blocks the button that opens the registration 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 javascript function is executed to save the data and in this same function, the verification function is invoked, thus when the registration window is closed, the system indicates that the data has been 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" within the function to save the data it does not work. Below follows the section 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';
  • i took a test and switched the cont variable in searchLeituras() by '1' and it worked, can anyone explain to me what might be wrong?

  • Managed to solve?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.