Yet Another Autocomplete

码农软件 · 软件分类 · jQuery自动完成插件 · 2019-12-13 11:41:42

软件介绍

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);
}
?>

本文地址:https://www.codercto.com/soft/d/21051.html

Python高性能(第2版)

Python高性能(第2版)

[加] 加布丽埃勒•拉纳诺(Gabriele Lanaro) / 袁国忠 / 人民邮电出版社 / 2018-8 / 59.00元

本书是一本Python性能提升指南,展示了如何利用Python的原生库以及丰富的第三方库来构建健壮的应用程序。书中阐释了如何利用各种剖析器来找出Python应用程序的性能瓶颈,并应用正确的算法和高效的数据结构来解决它们;介绍了如何有效地利用NumPy、Pandas和Cython高性能地执行数值计算;解释了异步编程的相关概念,以及如何利用响应式编程实现响应式应用程序;概述了并行编程的概念,并论述了如......一起来看看 《Python高性能(第2版)》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具