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://codercto.com/soft/d/21051.html

算法笔记上机训练实战指南

算法笔记上机训练实战指南

胡凡、曾磊 / 机械工业出版社 / 2016-7 / 57

《算法笔记上机训练实战指南》是《算法笔记》的配套习题集,内容按照《算法笔记》的章节顺序进行编排,其中整理归类了PAT甲级、乙级共150多道题的详细题解,大部分题解均编有题意、样例解释、思路、注意点、参考代码,且代码中包含了详细的注释。读者可以通过本书对《算法笔记》的知识点进行更深入的学习和理解。书中印有大量二维码,用以实时更新或补充书籍的内容及发布本书的勘误。 《算法笔记上机训练实战指南》可......一起来看看 《算法笔记上机训练实战指南》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

SHA 加密
SHA 加密

SHA 加密工具