File: ajax.html

Recommend this page to a friend!
  Classes of amani  >  PHP Password Generate  >  ajax.html  >  Download  
File: ajax.html
Role: Auxiliary data
Content type: text/plain
Description: ajax example of password generate class
Class: PHP Password Generate
Generate random password text of given length
Author: By
Last change:
Date: 6 years ago
Size: 1,364 bytes
 

 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>password generate</title>

<script type="text/javascript">

<!-- 

//Browser Support Code
function ajaxFunction(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			// Write received password from ajax request to div
			document.getElementById("result").innerHTML = ajaxRequest.responseText;
		}
	}
	ajaxRequest.open("GET", "PassGenerate.php?len=20", true);
	ajaxRequest.send(null); 
}

</script>

</head>
<body>
	<a class="get_pass" onclick="ajaxFunction()">Click to Get New Password</a><br />
	<div id="result"></div>
</body>

For more information send a message to info at phpclasses dot org.