Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/12/2011, 22:32
breaststroke
 
Fecha de Ingreso: octubre-2010
Mensajes: 189
Antigüedad: 13 años, 7 meses
Puntos: 0
traer variables de otra página ayudándose de Ajax

holas, muy buenas.

No sé si debo enviar este mensaje aquí, porque no es sólo sobre Javascript sino tb sobre Ajax.
Bueno, esta es mi duda:
Tengo la siguiente función:


Código HTML:
<script type="text/javascript">
function showUser(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  } 
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   [COLOR="Red"] document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }[/COLOR]
  }
[COLOR="Blue"]xmlhttp.open("GET","getuser.php?q="+str,true);
xmlhttp.send();[/COLOR]
}
</script> 
Con lo que tengo marcado en rojo recojo lo mostrado en la página getuser.php.
Me gustaría poder traer una variable también, sin necesitar de mostrar su valor.
Igual que mando una con la función marcada en azul, ¿no puedo también traer una variable?

¡Muchísimas gracias!