Tag Archives: ajax

Change dropdown values dynamically

We have 2 drop down boxes.

When we select one, we want that second one to be auto-populated with corresponding values to our selection.

This snippet is part of a php code invoked by ajax. It’s purpose is to respond to ajax call in form {“values”:[{“value”:”txt”},{…}]}

Ex: {"values":[{"value":"10","txt":"Aged care service"},{"value":"11","txt":"Social housing"}]}


Ajax call:


Trigger can be:

or using “onChange” event in combobox.