How to inject options/optgroups to an jqeryMobile enhanced select menu.?

Below is an example of injecting options to an jqeryMobile select menu using json data. In a real time application scenario the json data will be returned from an ajax call. The sample uses hardcoded json data.