-
Notifications
You must be signed in to change notification settings - Fork 23
/
EjemploRSS.html
39 lines (32 loc) · 884 Bytes
/
EjemploRSS.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<body>
<h2>Oferta Pública de Empleo (OPE) de la Administración Autonómica de Euskadi 2018</h2>
<button type="button" onclick="loadXMLDoc()">
see data</button>
<p id="demo"></p>
<script>
function loadXMLDoc() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xmlhttp.open("GET", "https://sofiaherrador.github.io/practicaDatos/rss/ope.rss", true);
xmlhttp.send();
}
function myFunction(xml) {
var x, i, xmlDoc, txt;
xmlDoc = xml.responseXML;
txt = "";
x = xmlDoc.getElementsByTagName("item");
for (i = 0; i< x.length; i++) {
ti = x[i].getElementsByTagName("title");
txt += ti[0].childNodes[0].nodeValue + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}
</script>
</body>
</html>