Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/11/2007, 07:01
Jeibi
 
Fecha de Ingreso: noviembre-2007
Ubicación: Madrid
Mensajes: 96
Antigüedad: 17 años, 4 meses
Puntos: 2
Ajax con Firefox

Hola a todos, como veo este no es un problema nuevo y que hay bastante información. Pero desafortunadamente no consigo hacer que me funcione mirando la información de los otros temas posteados. Mi código es el siguiente:

Código HTML:
function objAjax(){
	try{
		xmlhttp = new ActiveXObjet("Msxml2.XMLHTTP");
	}catch (e) {
		try{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {
			xmlhttp = false;
		}
	}	
	if (!xmlhttp && typeof XMLHttpRequest !='undefined'){		
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp
}
oXML = nuevoAjax();
oXML.open('GET','ServletCatList?menu='+escape(menu),false);
if (window.ActiveXObject)
          oXML.onreadystatechange=handleServlet;
else if (window.XMLHttpRequest)
          oXML.onreadystatechange=handleServlet();
oXML.send('');


function handleServlet()
{
          alert(oXML.readyState);	
          if(oXML.readyState==4)
          {
                if(oXML.status==200)
	        {
                      var res = oXML.responseXML.documentElement;
                      for(i = 0;i < res.getElementsByTagName'resultado').length;i++)
	             {
	                var item = res.getElementsByTagName('resultado')[i];
	                getData(item);
	                showResults();				
                         }	
	         }
	        else
	       {
	           alert("Error loading pagen"+ oXML.status +":"+oXML.statusText);
	        }
         }
}
Muestro un alert para ver hasta que nivel llega readyState, y solo me muestra el número 1 y después se sale de la función, asique nunca puede recibir la respuésta del servidor.
Esto me funciona perfectamente en IE, ¿alguien sabe cual es mi problema?, ¿porqué no llega hasta el nivel 4 del ajax?

muchas gracias