Ver Mensaje Individual
  #4 (permalink)  
Antiguo 07/07/2011, 13:28
facuferrari
 
Fecha de Ingreso: mayo-2011
Mensajes: 42
Antigüedad: 13 años
Puntos: 0
Respuesta: problemas con httprequest

estoy siguiendo los pasos del tutorial de w3schools de ajax por ahora tengo esto y cuando abro la pagina me salta el error de "no se ha podido cargar el archivo" y los valores de readyState y status son 4 y 0 respectivamente, según el tutorial el status solo puede ser 200 = "OK" o 404 el famoso page not found, pero a mi me da 0 por que sera? el código es este:
Código:
var xmlhttp;
//------CREAMOS OBJETO------//
	if(window.XMLHttpRequest){
		xmlhttp = new XMLHttpRequest;
	}
	else{
		xmlhttp = new ActiveObject("Microsoft.XMLHTTP");
	}
//------CREAMOS OBJETO------//

		xmlhttp.open("GET","notices.xml", true);
		xmlhttp.send();
		xmlhttp.onreadystatechange=getXMLData();

	function getXMLData(){
	if (xmlhttp.readyState = 4 && xmlhttp.status == 200){
		
		xmlDoc = xmlhttp.responseXML;
		txt = "";
		x = xmlDoc.getElementsByTagName("RCONTENT");
		
			for (i=0 ; i< x.length ; i++){
				txt = txt + x[i].childNodes[0].nodeValue + "<br/>";
			}
		
		document.getElementById("noticias").innerHTML = txt;
		}

	else{
		alert('no se pudo cargar el archivo');
		document.write(xmlhttp.readyState + "<br/>");
		document.write(xmlhttp.status);
	}
	}