AJAX and filtered request

Hello,

I have trouble with an AJAX request, and here’s what’s bethering me :
I want the user to be able to select a town from a database (36,000 records), so I made a popup on the input click in order to isplay two inputs (a zip code and a text inputs).
What I want is that when a zip code is entered, the data is filtered so i can choose a city with that zip code (or partial zip code).
Same with text filter.
And eventually, the result is displayed in the “Origin” input.

Here’s the code, it’s not working like I want but the idea is there:
http://webix.com/snippet/b332156b

I hope you’ll be able to help me out

Hello,

you can consider “suggest” with server-side suggestions:

http://docs.webix.com/desktop__suggest.html#suggestlistwithserversidedata

http://docs.webix.com/samples/13_form/01_controls/15_suggest_server.html

I worked on it yesterday and I came up with a solution, but it doesn’t fit exactly what I want to achieve here.

http://webix.com/snippet/b7ed3850

The thing is, I concatenate the url to match the zip code and the text entered, but the result is not quite perfect as you can see.
Is there another and a better way to bind those 2 inputs to the same datafeed ?
Later on, I’ll have to add more inputs (like countries), so the system has to be better than this.

Thank you for answering !

but the result is not quite perfect as you can see

Could you please specify what exactly does not work ?

When I click on the ZIP Code input, the result is not sent straight away.
It’s the second input that triggers the AJAX call (and if a ZIP code is present in the first input, the result is filtered as desired).

I don’t find this very user friendly. I would have prefered to be able to call the AJAX request on any of the two inputs with the result shown in either one input or in a third one.
I don’t quite know if webix is able to provide something like I want or I am going tobe forced to change my system ?