Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Insert

Usar variaveis de uma funçao em outra funcao nao vai

Recommended Posts

Pessoal tenho este script em ajax mas minha duvida acho que é em javascript mesmo:

 

function pesquisar_dominio_whois(dominio,extensao){	if (dominio != ""){	 http.open("GET", "inc/pesquisar.dominio.whois.php?dominio=" + dominio + extensao, true);	 http.onreadystatechange = handleHttpResponse_dominio_whois;	  http.send(null);	} else {	 alert('Você deve digitar o nome do dominio!');}}function handleHttpResponse_dominio_whois(){  if (http.readyState == 4) {	results = http.responseText;	if (results == "1"){	  alert('Ja registrado"');	  document.getElementById( 'whois_livre' ).style.display = "none";	  document.getElementById( 'whois_registrado' ).style.display = "block";	} else {	  document.getElementById( 'whois_registrado' ).style.display = "none";	  document.getElementById( 'whois_livre' ).style.display = "block";	}  }}
Nao estou conseguindo usar a variavel dominio e extesao na funcao de baixo a function handleHttpResponse_dominio_whois() como posso fazer isso? pois queria por assim:

 

function handleHttpResponse_dominio_whois()

{

if (http.readyState == 4) {

results = http.responseText;

if (results == "1"){

alert('Ja registrado"');

document.getElementById( 'whois_livre' ).style.display = "none";

document.getElementById( 'whois_registrado' ).style.display = "block";

document.getElementById( 'whois_registrado' ).innerHTML = "<div>dominio</div>";

} else {

document.getElementById( 'whois_registrado' ).style.display = "none";

document.getElementById( 'whois_livre' ).style.display = "block";

document.getElementById( 'whois_livre' ).innerHTML = "<div>dominio</div>";

}

}

}

Compartilhar este post


Link para o post
Compartilhar em outros sites

Chamando a variavel na outra função.

function handleHttpResponse_dominio_whois(dominio,extensao){if (http.readyState == 4) {results = http.responseText;if (results == "1"){alert('Ja registrado"');document.getElementById( 'whois_livre' ).style.display = "none";document.getElementById( 'whois_registrado' ).style.display = "block";document.getElementById( 'whois_registrado' ).innerHTML = "<div>dominio</div>";} else {document.getElementById( 'whois_registrado' ).style.display = "none";document.getElementById( 'whois_livre' ).style.display = "block";document.getElementById( 'whois_livre' ).innerHTML = "<div>dominio</div>";}}}

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.