New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query in URL path instead of parameter #67

klawry opened this Issue Aug 20, 2015 · 3 comments


None yet
3 participants

klawry commented Aug 20, 2015


I was curious if it's possible to pass the user's search input as part of the URL path instead of as a query string parameter.

All of the examples in the documentation show adding a query string parameter "d" by using the data property. Example:

url: [{
    type: "POST",
    url: "http://server/user",
    data: {
        q: "{{query}}"
}, "data.user"]

This produces a URL that looks like: http://server/user?q=john However I need the user's search to appear in the path. I want the URL to be: http://server/user/john

Can this be accomplished without changing the typeahead source code? Ideally, the {{query}} tag could be added to the URL setting instead like url: "http://server/user/{{query}}".



This comment has been minimized.


running-coder commented Aug 20, 2015

Hey klawry,

I've added the option to add "{{query}}" inside the Ajax url as you needed.
Tested with dynamic: true option and it worked as expected, let me know.



This comment has been minimized.

klawry commented Aug 21, 2015

Awesome! Thanks so much for your help.


This comment has been minimized.

mockingjs commented Aug 23, 2015

This is exactly what I was looking for! Thank you!

running-coder added a commit that referenced this issue Sep 13, 2015

Version 2.1.0
New Features
Closes #30 #71 Adding correlativeTemplate to compile the template and soften the search matching mechanism
Closes #67 Adding the possibility to have the {{query}} word replace inside the Ajax Url
Closes #65 Added Bootstrap example

Fixes #54: onSubmit callback was not receiving proper item information
Fixes #58: Debug option is now being considered and will not print if set to false, make sure to use the /dist/jquery.typeahead.min.js version in production
Fixes #62 IE9 doesn't trigger "input" event when text gets removed
Fixes #64 options.template was unable to display "false" or "0" value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment