Noticias Weblogs Foros Wiki Código

RecorteX

458 usuarios y 235 recortes de código
Usuario

Contraseña
Crear cuenta
asp csharp css fechas Flash html imagenes java javascript linux mysql oracle php sql SQLServer url vbnet web xhtml xml
Top Usuarios
fjmp76 (35)
albin (31)
josuebasurto (31)
juanjo (29)
pedrocaro (9)
stanz (8)
AndiXTRM (7)
Joserra (7)
miiglesi (6)
aplyca (5)
Top Etiquetas
php (38)
vbnet (27)
javascript (26)
html (25)
java (23)
csharp (18)
sql (17)
mysql (13)
xml (13)
css (10)
Flash (7)
imagenes (7)
xhtml (7)
asp (6)
linux (6)
fechas (6)
SQLServer (5)
oracle (5)
url (5)
web (5)

Obtener un contenido text/xml con una petición HTTP

No hay mucho que decir, a veces sencillamente solo quieres poder leer ficheros XML, y luego meterlo con un .innerHTML a lo bestia, no necesitas todo un framework ajax para eso.

function getContent(sURL) {
	var xmlhttp;
	if(window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
		xmlhttp.open("GET", sURL, false);
		xmlhttp.send(null);
	} else if (window.ActiveXObject) {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		if(xmlhttp) {
			xmlhttp.open("GET", sURL, false);
			xmlhttp.send();
		}
	}
	return xmlhttp.responseXML;
}
...
Identifícate para dejar un comentario.
info@recortex.com - Proyecto: Juanjo Navarro, 2006 - Diseño: Albin - Información legal y técnica