-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEuropeBT.html
More file actions
47 lines (42 loc) · 968 Bytes
/
Copy pathEuropeBT.html
File metadata and controls
47 lines (42 loc) · 968 Bytes
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
40
41
42
43
44
45
46
47
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<script>
/* This script shows how to use AJAX and jQuery to retrieve and
* parse an XML file.
*
*/
$(document).ready(function()
{
$.ajax({
type: "GET",
url: "AustriaBavaria.xml",
dataType: "xml",
success: handleResponse,
error: failedxml
});
});
function failedxml(){
$("#title").append('FAIL');
}
function handleResponse(xml) {
$(xml).find("tour").each(function()
{
$("#title").html("<h1>"+$(this).attr("title") + "</h1><br />");
});
$(xml).find("stop").each(function(){
$("#stop").append("<h2>"+$(this).find("title").text());
$(this).find("hotel").each(function(){
$("#stop").append($(this).attr("name")+"<br />");
});
});
}
</script>
<title>XML Read</title>
</head>
<body>
<div id="title"></div>
<div id="stop"></div>
</body>
</html>