Permalink
Browse files

First commit

  • Loading branch information...
1 parent efccf57 commit 1adada0933beaaf889ee807978d065e17c0cd805 @loopj loopj committed Jul 11, 2009
Showing with 783 additions and 0 deletions.
  1. +50 −0 examples/demo.html
  2. +15 −0 examples/php-example.php
  3. +490 −0 src/jquery.tokeninput.js
  4. +118 −0 styles/token-input-facebook.css
  5. +110 −0 styles/token-input.css
View
@@ -0,0 +1,50 @@
+<html>
+<head>
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
+
+ <script type="text/javascript" src="jquery.tokeninput.js"></script>
+
+ <link rel="stylesheet" href="styles/token-input.css" type="text/css" />
+ <link rel="stylesheet" href="styles/token-input-facebook.css" type="text/css" />
+
+
+ <script type="text/javascript">
+ $(document).ready(function() {
+ $("#tokenize").tokenInput("http://loopj.com/tokeninput/tvshows.php", {
+ hintText: "Type in the names of your favorite TV shows",
+ noResultsText: "No results",
+ searchingText: "Searching..."
+ });
+
+ $("#tokenize2").tokenInput("/tokeninput/tvshows.php", {
+ classes: {
+ tokenList: "token-input-list-facebook",
+ token: "token-input-token-facebook",
+ tokenDelete: "token-input-delete-token-facebook",
+ selectedToken: "token-input-selected-token-facebook",
+ highlightedToken: "token-input-highlighted-token-facebook",
+ dropdown: "token-input-dropdown-facebook",
+ dropdownItem: "token-input-dropdown-item-facebook",
+ dropdownItem2: "token-input-dropdown-item2-facebook",
+ selectedDropdownItem: "token-input-selected-dropdown-item-facebook",
+ inputToken: "token-input-input-token-facebook"
+ }
+ });
+ });
+ </script>
+</head>
+
+<body>
+ <h1>Jquery Tokenizing Autocomplete Input</h1>
+
+ <div>
+ <h2>List style</h2>
+ <input type="text" id="tokenize" name="blah" />
+ </div>
+
+ <div>
+ <h2>Facebook style</h2>
+ <input type="text" id="tokenize2" name="blah2" />
+ </div>
+</body>
+</html>
View
@@ -0,0 +1,15 @@
+<?
+mysql_pconnect("localhost", "username", "password") or die("Could not connect");
+mysql_select_db("mydatabase") or die("Could not select database");
+
+$query = sprintf("SELECT id, name from mytable WHERE name LIKE '%%%s%%' ORDER BY something DESC LIMIT 10", mysql_real_escape_string($_GET["q"]));
+$arr = array();
+$rs = mysql_query($query);
+
+while($obj = mysql_fetch_object($rs))
+{
+ $arr[] = $obj;
+}
+
+echo json_encode($arr);
+?>
Oops, something went wrong.

0 comments on commit 1adada0

Please sign in to comment.