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.

A Demo can be seen here

 

Also refer: http://jquerymobile.com/demos/1.2.0/docs/forms/selects/