This is a very broad question so I am going to offer an outline.
- Use
get_terms
to create your first select box.- This would be done in PHP.
- For the second box you will need to use Javascript.
- Once both boxes are populated, your Javascript can insert the button
into the DOM
It should not be very complicated but it is a fair bit of code. Try to get started and [edit] your question with more specific problems if you need to.
Be aware, that pure Javascript issues/questions are off-topic here per the faq. Obviously, though related to Javascript, the use of the AJAX API would not be off-topic, as that is a WordPress specific API.