javascript - Populate a html dropdownlist from a comma delimted JSON object with distinct values -
i have json object returns several key value pairs. 1 of languages key , contains comma separated values e.g "english, hindi,french" etc
what require distinct values language keys value , following dropdown list.
the following inputing language values dropdown not handling comma separating values, can please.
select language_
$('#combolist-languages').html(function () { var ret = '<option value="-1" selected>select language_</option>', u = user.slice(), arr = []; (function get() { if (u.length) { var v = u.shift(); if ($.inarray(v.languages, arr) == -1) { arr.push(v.languages); ret += '<option value="">' + v.languages + '</option>'; } get(); } }()); return ret; });
example link -
31.222.187.42/hca-consulting/farm/index.html
note following returns records db: search name > browse names
you can use javascript spilt function , put values array pass dropdown list.
for json key value pairs can separate "."
Comments
Post a Comment