testxmlify.html
2 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Nur zum testen</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<script src="js/helper.js" type="text/javascript"></script>
<script src="js/xmlify.js" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var req = null;
var data;
function dummy (data)
{
this.var1 = null;
this.var2 = null;
this.var3 = null;
this.var4 = null;
dummy.baseConstructor.call (this, data);
}
extend (dummy, c_xmlify);
function getData ()
{
switch (req.readyState)
{
case 4:
if (req.status != 200)
alert ("Fehler:" + req.status);
else
data = deXmlify (req.responseXML);
console.dir (data);
return true;
default:
return false;
}
}
function updData ()
{
// erstellen des requests
try
{
req = new XMLHttpRequest();
}
catch (e)
{
try
{
req = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
req = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (failed)
{
req = null;
}
}
}
if (req == null)
alert("Error creating request object!");
// anfrage erstellen (GET, url ist localhost,
// request ist asynchron
var url = 'http://localhost/~georg/bilder/ajax+json/ajax.php';
req.open("GET", url, true);
// Beim abschliessen des request wird diese Funktion ausgeführt
req.onreadystatechange = getData;
req.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
req.send(null);
}
//]]>
</script>
</head>
<body>
<script language="javascript">
//<![CDATA[
updData ();
console.log ('%s', 'jokus');
//]]>
</script>
</body>
</html>