[bootstrap] typeahead

plain bootstrap v2.x, combo autocomplete

With Twitter bootstrap v3 the typeahead plugin had been dropped. @mdo says: “in favor of folks using Twitter’s typeahead. Twitter’s typeahead has more features than the old bootstrap-typeahead.js and less bugs.” more http://twitter.github.io/typeahead.js/

<input type="text" class="form-control" id="test" placeholder="fullname">
var search = $('input#test');

    source: [
        'Dave Mustaine',
        'Tom Morello',
        'Jim Root',
        'Kirk Hammett',
        'Joe Perry',
        'Jimi Hendrix',
        'Eric Clapton',
        'Billy Duffy',
        'Johnny Hickman',
        'Eddie Van Halen',
        'Dimebag Darrell',
        'Noel Gallagher'
    items: 5


fuck it, dont waste your time, use :

truly working.

    source: function (query, process) {
        return $.get("node_search.php?txt=" + query, function (data) {
            return process(data);
require_once ('config.php');

$db = connect_mysql();

$rows = getSet($db,"select node_id as id, node_title as name from nodes where node_body like CONCAT('%', ?, '%') or node_title like CONCAT('%', ?, '%')",array($_GET&#91;'txt'&#93;,$_GET&#91;'txt'&#93;));

$r = array();
foreach($rows as $row) {
	$r&#91;&#93; = array("id" => $row["id"], "name" => $row["name"]);

echo json_encode($r);

By: |02/10/2014|categories: