Level 73
Dynamic means you can have multiple modals ? You can try to use a class instead of an id for the elements, if you happen to have more than one element on the same page using the same id.
By that I mean replace id="country" with class="country" and then use $('.country).select2({
or make those IDs dynamic as well, like country-ID and pass some ID of the item you are showing in the modal.