Why is a loop created when I return the focus when I receive the ajax?

0

Here I have the code of the function that runs when the ajax is successful:

function existe_usuario_o_no(registo) {

    if (registo.booleano) {

        alert(registo.mensaje);
        $(".usuario").val("");
        $("#tr_oculto").hide();
      //$(".usuario").focus();
    }else {

        alert("Chao");
    }

}

register.boolean returns true or false, if it is true the message that already exists in the database is executed, cleaning the user field and hiding the message again, the problem occurs when I put the focus back on the user input for the user to re-enter it, a loop is created and the alert does not stop, if I do not focus it only runs once it is as it should be ... if someone knows why it would be of great help , thanks:)

    
asked by Shum 25.07.2018 в 02:51
source

0 answers