Ver Mensaje Individual
  #10 (permalink)  
Antiguo 08/07/2011, 07:07
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
usando wamp server y ese script, aun así no me funciona, gracias de todas formas ! pongo lo que tengo hasta ahora para ver si le encuentras algun error.
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>home page | notice</title>
<link href="notice_style.css" rel="stylesheet" type="text/css" />

<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>
</head>

<body onload='getXMLHTTPRequest()'>

<div id='content'>

<div id='tittle'></div>

<div id='noticias'>

</div>

</div>
</body>
</html>
y el xml:
Código:
<?xml version="1.0" encoding="iso-8859-1"?>

<TITTLE>noticia 1</TITTLE>
<RCONTENT>Contenido reducido</RCONTENT>
<CONTENT>Contenido completo</CONTENT>


<TITTLE>noticia 2</TITTLE>
<RCONTENT>Contenido reducido</RCONTENT>
<CONTENT>Contenido completo</CONTENT>



ok creo que es por tu xml le falta esto


<?xml version="1.0" encoding="iso-8859-1"?>

<nodo>

<TITTLE>noticia 1</TITTLE>
<RCONTENT>Contenido reducido</RCONTENT>
<CONTENT>Contenido completo</CONTENT>


<TITTLE>noticia 2</TITTLE>
<RCONTENT>Contenido reducido</RCONTENT>
<CONTENT>Contenido completo</CONTENT>

</nodo>