devbridge / jQuery-Autocomplete

Ajax Autocomplete for jQuery allows you to easily create autocomplete/autosuggest boxes for text input fields
https://www.devbridge.com/sourcery/components/jquery-autocomplete/
Other
3.56k stars 1.67k forks source link

Multiple params with same key #412

Closed carwin closed 9 years ago

carwin commented 9 years ago

I'm working with the geonames service and there are times when I need to specify the same param twice for something like limiting results to only two countries. The URL might look something like this:

http://api.geonames.org/searchJSON?name=chicago&country=US&country=CA

For that I'd need,

params: {
  country: 'US',
  country: 'CA',
}

Since the params option is an object, I can't add country twice, so it'd be nice if params could take arrays, something like:

params: {
  country: ['US', 'CA']
}

Is there another way to do this that I'm missing?

tkirda commented 9 years ago

Params passed as data parameter for jquery's ajax method.

Then only way to work around this, would be instead of serviceUrl as string, you pass a function, which would format url for the request.

carwin commented 9 years ago

Cool thanks.