jQuery, ajax, php, msyql: auto

I have a mysql db table that has every US city, state, zip, lat, long. On my site page I have a form input for cities. As the user types, I'd like to suggest city, state. What current practices/techniques are good? (Limitations are jQuery, PHP, MYSQL)

Solution


jQuery UI has a nice autocomplete feature.

JQuery UI Autocomplete

It is quite well configurable. You should send the data in JSON format from the server, Autocomplete will mostly handle the rest. Check out the docs.


you may want to try a pre-existing plugin such as:

http://code.drewwilson.com/entry/autosuggest-jquery-plugin

Looks like it uses ajax and JSON to get data from your server. All styling is done in CSS too :o)

链接地址: http://www.djcxy.com/p/6016.html

上一篇: 从另一个类访问全局静态变量

下一篇: jQuery,ajax,php,msyql:auto