Permalink
Browse files

Made the simple setup even simpler

  • Loading branch information...
1 parent fed6eb4 commit 8b7b6135988d3a5703efbda769027633f5afa697 @pwarelis committed May 6, 2012
Showing with 7 additions and 4 deletions.
  1. +4 −4 README.markdown
  2. +3 −0 typeahead.js
View
@@ -13,17 +13,17 @@ To make a regular typeahead plugin query a server for the source, just specify a
### Simple use
+For a quick setup, specify a source url to pull data from.
+
```javascript
$("#ajax-typeahead").typeahead({
- ajax: {
- url: "/path/to/source"
- }
+ ajax: "/path/to/source"
});
```
### Options
-There are a few options to make this a bit more flexible.
+There are a few options to make this a bit more flexible. To use these, make the ajax option into an object containing any of these options:
- `ajax.timeout`
Specify the amount of time to wait for keyboard input to stop until you send the query to the server. Default is at 300ms.
View
@@ -40,6 +40,9 @@
this.$menu = $(this.options.menu).appendTo('body')
if (this.options.ajax) {
var ajax = this.options.ajax;
+ if (typeof ajax == "string") {
+ ajax = { url:ajax };
+ }
this.ajax = {
url : ajax.url,
timeout : ajax.timeout || 300,

0 comments on commit 8b7b613

Please sign in to comment.