1
I have 2 functions, where I wish, to satisfy a condition in the main function I must call an external function, using in 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 2nd function it is undefined
...
Vlw man, the first way didn’t work, but with
input_nome_Ajax.call(this)
, was....– MagicHat