-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Koushik Biswas
committed
May 21, 2017
0 parents
commit f7fe2b0
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
date_default_timezone_set('UTC'); | ||
$timenow = date('l jS \of F Y h:i:s A'); | ||
$queryval = $_GET['searchtext'] . ' ' . $timenow; | ||
echo $queryval; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script type="text/javascript"> | ||
function OnInput (event) { | ||
var textdata = event.target.value; | ||
var phpurl = 'calldatastore.php?searchtext=' + textdata; | ||
getRequest( | ||
phpurl, | ||
drawOutput, | ||
drawError | ||
); | ||
} | ||
function drawError() { | ||
var container = document.getElementById('output'); | ||
container.innerHTML = 'Oops, there was an error'; | ||
} | ||
function drawOutput(responseText) { | ||
var container = document.getElementById('output'); | ||
container.innerHTML = responseText; | ||
} | ||
function getRequest(url, success, error) { | ||
var req = false; | ||
try{ | ||
// most browsers | ||
req = new XMLHttpRequest(); | ||
} catch (e){ | ||
// IE | ||
try{ | ||
req = new ActiveXObject("Msxml2.XMLHTTP"); | ||
} catch(e) { | ||
// try an older version | ||
try{ | ||
req = new ActiveXObject("Microsoft.XMLHTTP"); | ||
} catch(e) { | ||
return false; | ||
} | ||
} | ||
} | ||
if (!req) return false; | ||
if (typeof success != 'function') success = function () {}; | ||
if (typeof error!= 'function') error = function () {}; | ||
req.onreadystatechange = function(){ | ||
if(req.readyState == 4) { | ||
return req.status === 200 ? | ||
success(req.responseText) : error(req.status); | ||
} | ||
} | ||
req.open("GET", url, true); | ||
req.send(null); | ||
return req; | ||
} | ||
// Internet Explorer | ||
//function OnPropChanged (event) { | ||
// if (event.propertyName.toLowerCase () == "value") { | ||
// alert ("The new content: " + event.srcElement.value); | ||
// } | ||
//} | ||
</script> | ||
</head> | ||
<body> | ||
<form action="upload.php" method="post" enctype="multipart/form-data" style="font-family:Tahoma"> | ||
Type your search text here:<br/><br/> | ||
<input type="text" oninput="OnInput(event);" onpropertychange="OnPropChanged(event);" autofocus><br/> | ||
<br/> | ||
<div id="output" style="border: 1px solid black">Watch out for AJAX output here</div> | ||
</form> | ||
</body> | ||
</html> |