Download
User Rating: 0/5 ( 0 votes)
FaceBook Autosuggest Like is a powerful jQuery plugin to transform an input field into a real timeautocompletion search engine, designed like facebook one.
Features:
- Autocomplete and ajax support
- Database search
- Support search plugins
- Support cache
- Cross Browser support ( IE > 5.5, FireFox, Safari, Opera )
Include jquery lib and bsn.AutoSuggest lib
<script type="text/javascript" src="lib/jquery-1.2.1.pack.js"></script>
<script type="text/javascript" src="lib/autosuggest/bsn.AutoSuggest_2.1.3.js"></script>
Create a html code:
<input type="text" size="24" name="search_txt" id="input_search_all" class="search_txt">
<div class="search_response" style="display:none;" id="input_search_all_response"></div>
Call Autocomplete
// Set autosuggest options with all plugins activated & response in xml
var options = {
script:"AjaxSearch/_doAjaxSearch.action.php?limit=8&",
varname:"input",
shownoresults:true, // If disable, display nothing if no results
noresults:"No Results", // String displayed when no results
maxresults:8, // Max num results displayed
cache:false, // To enable cache
minchars:2, // Start AJAX request with at leat 2 chars
timeout:100000, // AutoHide in XX ms
callback: function (obj) { // Callback after click or selection
// For example use :
// Build HTML
var html = "ID : " + obj.id + "<br>Main Text : " + obj.value + "<br>Info : " + obj.info + "<br>Currency : " + obj.currency;
$('#input_search_all_response').html(html).show() ;
// => TO submit form (general use)
//$('#search_all_value').val(obj.id);
//$('#form_search_country').submit();
}
};
// Init autosuggest
var as_json = new bsn.AutoSuggest('input_search_all', options);