$.ajax({
url:'',
type:'get',
success:function(data) {
var themcobobox = [{'text':'','id':''}];
for (var i = 0;i<data.length;i++) {
themcobobox.push({"text":data[i].text,"id":data[i].id});
}
$("#kk").combobox("loadData",themcombobox);
}
});
public static List<Map<String, String>> parseMapToJson(Map<String, String> map, String selectedVal, boolean isContainsKey) throws Exception{
List<Map<String, String>> retList = new ArrayList<Map<String, String>>();
for(Map.Entry<String, String> entry : map.entrySet()) {
String text = entry.getValue();
if(isContainsKey) {
text = entry.getKey() + ":" + text;
}
Map<String, String> retMap = new HashMap<String, String>();
retMap.put("id", entry.getKey());
retMap.put("text", text);
if (entry.getKey().equals(selectedVal)) {
retMap.put("selected", "true");
}
retList.add(retMap);
}
return retList;
}