Skip to content
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

remote call depends on another value #20

Closed
calexo opened this issue Feb 21, 2013 · 4 comments
Closed

remote call depends on another value #20

calexo opened this issue Feb 21, 2013 · 4 comments
Milestone

Comments

@calexo
Copy link
Contributor

calexo commented Feb 21, 2013

Hi !
Could remote call url depends on another value, such as another input field value ?
It works once, but then the url doesn't change on that value change.
Thanks a lot !

@jharding
Copy link
Contributor

Although it won't be straightforward, in v0.9 you'll be able to do this.

$('.typeahead').typeahead({
  remote: 'http://example.com?q=%QUERY',
  ajax: {
    beforeSend: function(jqXhr, settings) {
      settings.url = settings.url + '&anotherVal=' + $('.another-val').val();
    }
  }
});

The API may change somewhat, but hopefully you get the idea.

@calexo
Copy link
Contributor Author

calexo commented Feb 22, 2013

That will be perfect, thanks !

@jharding
Copy link
Contributor

What's the use case for this?

@calexo
Copy link
Contributor Author

calexo commented Feb 25, 2013

For example, chained select.
In my own case, I have an input field for country, then an input for region. I'd like typeahead to show only regions from that country.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants