testxmlify.html 2 KB
<!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>