Reputation: 89
I'm building a service website where one part requires users to enter the street name in a city and I'm planning to add Autocomplete functionality to the input field.
The number of my records of street names is about 2000, so my question is, which way should I use?
For jQuery or AJAX + PHP my concern is, that if the amount of the street names is too large it might effect the loading speed performance of the website.
Upvotes: 0
Views: 2846
Reputation: 14295
Long street names should not slow down the performance, only the size of the database itself. But 2000 entries should really be feasible.
I suggest ajax in jQuery clientside to call a php script on the server side. The ajax will give php a string of what the user entered (e.g., on every keypress), then php will look for a streetname like that in the database (using LIKE
in the query) and return, e.g., a json object with all street names that were found.
Upvotes: 0
Reputation:
I would advise select2. Easy to use and user-friendly (search, multiselect, etc)
Upvotes: 1
Reputation: 21406
You may try Ajax AutoComplete for jQuery
Ajax Autocomplete for jQuery allows you to easily create autocomplete/autosuggest boxes for text input fields. It is free to download. You may try a demo auto filling Country Names in the homepage itself.
Hope this helps...
Upvotes: 2
Reputation: 459
it’s usually done with jquery or another ajax ‘framework’ (e. g. mootools) and php/whatever server side language (e. g. asp, jsp, etc.) you decide to use to feed the ajax request.
Upvotes: 0