User Tools

Site Tools


kurs:ajax-get-emp_css
<?php 
require ('xajax/xajax_core/xajax.inc.php');
$xajax = new xajax();

$xajax->configure('javascript URI', '/');

function getemp($name) {  
  $db = oci_connect('hr', 'hr', 'orcl');
  $sql = sprintf(
   "select first_name, last_name, salary from employees    where 
     last_name  like '%s%%'",
	 $name);
   	 	
   $q = oci_parse($db, $sql);
   $r = oci_execute($q, OCI_DEFAULT);
while($table = oci_fetch_array($q, OCI_ASSOC+OCI_RETURN_NULLS)) {
   $row = implode($table, ' ');
   $result .= $row ."<br>";
   }
  
  $objResponse = new xajaxResponse();
  $objResponse->assign('emp_list', 'innerHTML', $result);	
	return $objResponse;
	
}

$req_get_emp =& $xajax->registerFunction('getemp');
$req_get_emp->setParameter(0, XAJAX_INPUT_VALUE, 'empname');
$xajax->processRequest();

?>
<html>
<head>
	<link rel="stylesheet" href="/demo.css" type="text/css">
	<title>Get Employee</title>	
	<?php
	$xajax->printJavascript();
  ?>
</head>
<body>
<div>
  <div id="u1">  
    Name: <input name="empname" id="empname" type="text" 
               size="30" maxlength="60" 
	 onkeyup='<?php $req_get_emp->printScript(); ?>;'> 
  </div>	
  <div id="u2">
	<div id="emp_list"></div><br />		
  </div>
</div>
</body>
</html>
H2 {color:blue}

#emp_list {color:green}

#u1 {with:350px; float:left}
#u2 {with:350px; float:left}
#u3 {with:350px; float:right}
kurs/ajax-get-emp_css.txt · Last modified: 2014/09/10 21:22 (external edit)