Yet Another Autocomplete
- 授权协议: 未知
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: http://plugins.jquery.com/project/YA_AutoComplete
软件介绍
I created this plugin because I was not happy with any of the other ones. This plugin will give you simple, clean autocomplete functionality on the selected text box.
Here's the code:
HTML File:
<form id="myform">
<input type="text" name="my_textbox" id="my_textbox" />
</form>
<script type="text/javascript">
<!--
$(function() {
var data = {
fn : 'lookup'
};
var options = {
min_length : 3,
error_responses : [
"No results.",
"Too many results."
]
};
$("#suggest").suggest("search.php", data, options);
});
-->
</script>
Example server-side PHP script, search.php:
<?php
// Prevent caching
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Jan 1, 2000"); // Date in the past
$fn = $_GET['fn'];
$allowed_fns = array('lookup');
if (!in_array($fn, $allowed_fns)) { exit; }
print call_user_func($fn);
function lookup() {
$q = valueIfSet($_GET['q']);
$attrs = array("uid", "givenname", "sn");
$filter = "level03=95C";
try {
$results = your_ldap_lookup_function($q, $attrs, $filter, true, , 1);
} catch (Exception $e) {
return "Too many results.";
}
if (count($results) === ) {
return "No results.";
}
$list = array();
foreach ($results as $result) {
$sn = $result['sn'];
$gn = $result['givenname'];
$uid = $result['uid'];
$name = "$sn, $gn ($uid)";
array_push($list, $name);
}
return implode("\n", $list);
}
?>
UNIX网络编程 卷1:套接字联网API(第3版)
[美]W. 理查德•史蒂文斯(W. Richard Stevens)、比尔• 芬纳(Bill Fenner)、安德鲁 M. 鲁道夫(Andrew M. Rudoff) / 匿名 / 人民邮电出版社 / 2014-6-1 / 129.00
《UNIX环境高级编程(第3版)》是被誉为UNIX编程“圣经”的Advanced Programming in the UNIX Environment一书的第3版。在本书第2版出版后的8年中,UNIX行业发生了巨大的变化,特别是影响UNIX编程接口的有关标准变化很大。本书在保持前一版风格的基础上,根据最新的标准对内容进行了修订和增补,反映了最新的技术发展。书中除了介绍UNIX文件和目录、标准I/......一起来看看 《UNIX网络编程 卷1:套接字联网API(第3版)》 这本书的介绍吧!
