I have 2 functions, where I want, when satisfying a condition in the main function I must call an external function, using this external function the current parameter in the first function.
//1 função
function check_fields(element)
{ if(this.value === "")
{ ...
}else if(!filter.test(this.value))
{ ...
}else if(this.id === "input_nome")
{ input_nome_Ajax(this);//<<-- Aqui quero chamar a 2º função
}
console.log(this.id);
}
//2º função
function input_nome_Ajax()
{ ...
var xmlreq = new XMLHttpRequest();
xmlreq.open("GET","functions/db/select_ajax_form_criar_conta.php?input_nome=" + this.value,false);//<<---Aqui o "this" está 'undefined' ???
xmlreq.send(null);//<<--Veja o final da linha acima ^^^^^^
...
}
The error is that the value I need in the second function is undefined
...