diff options
-rw-r--r-- | ajax/database/New Text Document.txt | 0 | ||||
-rw-r--r-- | ajax/database/getuser.php | 38 | ||||
-rw-r--r-- | ajax/database/index.htm | 20 | ||||
-rw-r--r-- | ajax/database/selectuser.js | 40 | ||||
-rw-r--r-- | ajax/form_suggestions/clienthint.js | 45 | ||||
-rw-r--r-- | ajax/form_suggestions/gethint.php | 71 | ||||
-rw-r--r-- | ajax/form_suggestions/index.htm | 14 | ||||
-rw-r--r-- | ajax/simple_form/index.htm | 36 | ||||
-rw-r--r-- | ajax/simple_form/time.php | 6 |
9 files changed, 0 insertions, 270 deletions
diff --git a/ajax/database/New Text Document.txt b/ajax/database/New Text Document.txt deleted file mode 100644 index e69de29..0000000 --- a/ajax/database/New Text Document.txt +++ /dev/null diff --git a/ajax/database/getuser.php b/ajax/database/getuser.php deleted file mode 100644 index bf6e677..0000000 --- a/ajax/database/getuser.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -$q=$_GET["q"]; - -$con = mysql_connect('localhost', 'peter', 'abc123'); -if (!$con) - { - die('Could not connect: ' . mysql_error()); - } - -mysql_select_db("ajax_demo", $con); - -$sql="SELECT * FROM user WHERE id = '".$q."'"; - -$result = mysql_query($sql); - -echo "<table border='1'> -<tr> -<th>Firstname</th> -<th>Lastname</th> -<th>Age</th> -<th>Hometown</th> -<th>Job</th> -</tr>"; - -while($row = mysql_fetch_array($result)) - { - echo "<tr>"; - echo "<td>" . $row['FirstName'] . "</td>"; - echo "<td>" . $row['LastName'] . "</td>"; - echo "<td>" . $row['Age'] . "</td>"; - echo "<td>" . $row['Hometown'] . "</td>"; - echo "<td>" . $row['Job'] . "</td>"; - echo "</tr>"; - } -echo "</table>"; - -mysql_close($con); -?>
\ No newline at end of file diff --git a/ajax/database/index.htm b/ajax/database/index.htm deleted file mode 100644 index 98b0009..0000000 --- a/ajax/database/index.htm +++ /dev/null @@ -1,20 +0,0 @@ -<html> -<head> -<script type="text/javascript" src="selectuser.js"></script> -</head> -<body> - -<form> -Select a User: -<select name="users" onchange="showUser(this.value)"> -<option value="1">Peter Griffin</option> -<option value="2">Lois Griffin</option> -<option value="3">Glenn Quagmire</option> -<option value="4">Joseph Swanson</option> -</select> -</form> -<br /> -<div id="txtHint"><b>Person info will be listed here.</b></div> - -</body> -</html>
\ No newline at end of file diff --git a/ajax/database/selectuser.js b/ajax/database/selectuser.js deleted file mode 100644 index a91721e..0000000 --- a/ajax/database/selectuser.js +++ /dev/null @@ -1,40 +0,0 @@ -var xmlhttp; - -function showUser(str) -{ -xmlhttp=GetXmlHttpObject(); -if (xmlhttp==null) - { - alert ("Browser does not support HTTP Request"); - return; - } -var url="getuser.php"; -url=url+"?q="+str; -url=url+"&sid="+Math.random(); -xmlhttp.onreadystatechange=stateChanged; -xmlhttp.open("GET",url,true); -xmlhttp.send(null); -} - -function stateChanged() -{ -if (xmlhttp.readyState==4) -{ -document.getElementById("txtHint").innerHTML=xmlhttp.responseText; -} -} - -function GetXmlHttpObject() -{ -if (window.XMLHttpRequest) - { - // code for IE7+, Firefox, Chrome, Opera, Safari - return new XMLHttpRequest(); - } -if (window.ActiveXObject) - { - // code for IE6, IE5 - return new ActiveXObject("Microsoft.XMLHTTP"); - } -return null; -}
\ No newline at end of file diff --git a/ajax/form_suggestions/clienthint.js b/ajax/form_suggestions/clienthint.js deleted file mode 100644 index 408c220..0000000 --- a/ajax/form_suggestions/clienthint.js +++ /dev/null @@ -1,45 +0,0 @@ -var xmlhttp - -function showHint(str) -{ -if (str.length==0) - { - document.getElementById("txtHint").innerHTML=""; - return; - } -xmlhttp=GetXmlHttpObject(); -if (xmlhttp==null) - { - alert ("Your browser does not support XMLHTTP!"); - return; - } -var url="gethint.php"; -url=url+"?q="+str; -url=url+"&sid="+Math.random(); -xmlhttp.onreadystatechange=stateChanged; -xmlhttp.open("GET",url,true); -xmlhttp.send(null); -} - -function stateChanged() -{ -if (xmlhttp.readyState==4) - { - document.getElementById("txtHint").innerHTML=xmlhttp.responseText; - } -} - -function GetXmlHttpObject() -{ -if (window.XMLHttpRequest) - { - // code for IE7+, Firefox, Chrome, Opera, Safari - return new XMLHttpRequest(); - } -if (window.ActiveXObject) - { - // code for IE6, IE5 - return new ActiveXObject("Microsoft.XMLHTTP"); - } -return null; -}
\ No newline at end of file diff --git a/ajax/form_suggestions/gethint.php b/ajax/form_suggestions/gethint.php deleted file mode 100644 index 8cb7379..0000000 --- a/ajax/form_suggestions/gethint.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -// Fill up array with names -$a[]="Anna"; -$a[]="Brittany"; -$a[]="Cinderella"; -$a[]="Diana"; -$a[]="Eva"; -$a[]="Evan"; -$a[]="Fiona"; -$a[]="Gunda"; -$a[]="Hege"; -$a[]="Inga"; -$a[]="Johanna"; -$a[]="Kitty"; -$a[]="Linda"; -$a[]="Nina"; -$a[]="Ophelia"; -$a[]="Petunia"; -$a[]="Amanda"; -$a[]="Raquel"; -$a[]="Cindy"; -$a[]="Doris"; -$a[]="Eve"; -$a[]="Evita"; -$a[]="Sunniva"; -$a[]="Tove"; -$a[]="Unni"; -$a[]="Violet"; -$a[]="Liza"; -$a[]="Elizabeth"; -$a[]="Ellen"; -$a[]="Wenche"; -$a[]="Vicky"; - -//get the q parameter from URL -$q=$_GET["q"]; - -//lookup all hints from array if length of q>0 -if (strlen($q) > 0) - { - $hint=""; - for($i=0; $i<count($a); $i++) - { - if (strtolower($q)==strtolower(substr($a[$i],0,strlen($q)))) - { - if ($hint=="") - { - $hint=$a[$i]; - } - else - { - $hint=$hint." , ".$a[$i]; - } - } - } - } - -// Set output to "no suggestion" if no hint were found -// or to the correct values -if ($hint == "") - { - $response="no suggestion"; - } -else - { - $response=$hint; - } - -//output the response -echo $response; -?>
\ No newline at end of file diff --git a/ajax/form_suggestions/index.htm b/ajax/form_suggestions/index.htm deleted file mode 100644 index c2fc742..0000000 --- a/ajax/form_suggestions/index.htm +++ /dev/null @@ -1,14 +0,0 @@ -<html> -<head> -<script src="clienthint.js"></script> -</head> -<body> - -<form> -First Name: <input type="text" id="txt1" onkeyup="showHint(this.value)" /> -</form> - -<p>Suggestions: <span id="txtHint"></span></p> - -</body> -</html>
\ No newline at end of file diff --git a/ajax/simple_form/index.htm b/ajax/simple_form/index.htm deleted file mode 100644 index 2c01922..0000000 --- a/ajax/simple_form/index.htm +++ /dev/null @@ -1,36 +0,0 @@ -<html> -<body> - -<script type="text/javascript"> -function ajaxFunction() -{ -var xmlhttp; -if (window.XMLHttpRequest) - { - // code for IE7+, Firefox, Chrome, Opera, Safari - xmlhttp=new XMLHttpRequest(); - } -else - { - // code for IE6, IE5 - xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); - } -xmlhttp.onreadystatechange=function() -{ -if(xmlhttp.readyState==4) - { - document.myForm.time.value=xmlhttp.responseText; - } -} -xmlhttp.open("GET","time.php",true); -xmlhttp.send(null); -} -</script> - -<form name="myForm"> -Name: <input type="text" name="username" onkeyup="ajaxFunction();" /> -Time: <input type="text" name="time" /> -</form> - -</body> -</html>
\ No newline at end of file diff --git a/ajax/simple_form/time.php b/ajax/simple_form/time.php deleted file mode 100644 index 3d938ae..0000000 --- a/ajax/simple_form/time.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php -// Date in the past -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Cache-Control: no-cache"); -echo(date("G:i:s",time())); -?>
\ No newline at end of file |