Login   Register  
Icontem

File: example.html

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Archzilon Eshun-Davies  >  xhr  >  example.html  >  Download  
File: example.html
Role: Example script
Content type: text/plain
Description: Example Usage
Class: xhr
Send AJAX requests with the XMLHttpRequest objects
Author: By
Last change:
Date: 2012-04-12 17:37
Size: 791 bytes
 

Contents

Class file image Download
<!Doctype html>
<html>
	<head>
		<title>xhr test</title>
		<script src="xhr.js" type="text/javascript"></script>
		<script>
		function showtext()
		{
		    a$.xhr("xhr.js", function() {
			document.getElementById('asi').innerHTML = 
				"<pre>"+resp+"</pre>";
			});
		}
		function showimage()
		{
		    a$.xhr("xhr.js", {callback:function() {
			document.getElementById('asi').innerHTML = 
				"<pre>"+resp+"</pre>";
			},
			async: true,
			method: "get"});
		}
		</script>
	</head>
	<body>
		<section>
			<input type="button" value="Load JS code" onclick="showtext();" />
			<div id="sst"></div>
			<input type="button" value="Load Image" onclick="showimage();" />
			<div id="asi" style="height:170px;overflow:scroll;"></div>
		</section>
	</body>
</html>