I'm trying to poplulate a select box that is dependent on another select box
<select>
<option value="a">a</option>
<option value="b">b</option>
</select>
<select>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
I want for example when a user selects the select1 (a), Select2 shows 1, 2 and 3 and when he chooses B, It shows 4,5,6 and so on.
The selectbox values is a PHP ARRAY object, I've tried jQuery to populate it using $.each
but that didn't work out as the array is something like:
{ "Option 1":[ {"name" : "test", "age" : "1"}, .... ] }
Thanks in advance.