I am trying to use \"Chosen\" plugin by harvest (http://harvesthq.github.com/chosen/) and it works for the static set of options I am passing. However, what I want is that w
I do it simply this way and it works perfectly:
// this variable can be filled by an AJAX call or so
var optionsArray = [
{"id": 1, "name": "foo"},
{"id": 2, "name": "bar"}
];
var myOptions = "";
for(var i=0; i'+optionsArray[i].name+'';
}
// uses new "chosen" names instead of "liszt"
$(".chosen-select").html(myOptions).chosen().trigger("chosen:updated");