Ajax for making one form element dependent on another

I have a list of pairs say [[1, ‘a’], [2, ‘b’],…

I need to make a form in which the numbers 1,2 etc would be a selection
list in one field and the [a,b…] would be autofilled in ajax mode.

Is this easy/possible?