Ver Mensaje Individual
  #7 (permalink)  
Antiguo 07/07/2011, 14:26
Avatar de Melecio
Melecio
 
Fecha de Ingreso: julio-2011
Ubicación: Coahuila
Mensajes: 320
Antigüedad: 12 años, 9 meses
Puntos: 8
Respuesta: problemas con httprequest

Cita:
Iniciado por facuferrari Ver Mensaje
A mi no me funciona ni en IE ni en firefox ni en chrome, una pregunta, esto deberia estar en un servidor o abriendolo desde el disco deberia funcionar ?


haora intenta con este a mi si me funciono en cualquier navegador

<script type="text/javascript">
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch (err2) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch (err3) {
req = false;
}
}
}
return req;
}

var xmlhttp= getXMLHTTPRequest();

//------CREAMOS OBJETO------//

xmlhttp.open("GET","notices.xml", true);

var ww = xmlhttp.onreadystatechange = getXMLData;
xmlhttp.send(null);

function getXMLData(){

var ww= xmlhttp.readyState ;
var w1= xmlhttp.status ;



if (xmlhttp.readyState == 4) {

if (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;
}

}
}
}

</script>