1var initQuantitiesDropdown = function () {
2 var options = [];
3 var selectedFruit = $("#fruits").val();
4 $.each(pageData.products[selectedFruit].quantities, function (key, value) {
5 options.push({
6 text: value,
7 id: key
8 });
9 })
10 $("#quantities").empty().select2({
11 data: options
12 });
13};
14
15$("#fruits").select2().change(initQuantitiesDropdown);
16initQuantitiesDropdown();
1var options = [];
2$.each(dataReturn, function (i, obj) {
3 //console.log(i);
4 //console.log(obj);
5 options.push({
6 text: obj.NickName,
7 id: obj.NickName
8 });
9})
10$("#BeneType").empty().select2({
11 data: options
12});