O'Reilly logo

PHP jQuery Cookbook by Vijay Joshi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Filling chained combo boxes that depend upon each other

This recipe tries to solve a very common task that is seen in many web applications, that is, filtering contents of a combo box according to the selection made in its previous combo box.

We will create an example where the user will be presented with three select boxes—one each for country, state, and town. Selecting a country will get its states and selecting a state will get its towns. Finally, on selecting a town we will display some information related to it.

The most important point here is that there will not be any page reloads. Instead, we will use AJAX to filter the contents silently. This will create a better user experience compared to classic web application behavior where it would ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required