Combobox population by means of JQuery and Ajax

This is the view municipalities.js.erb I have:

<% list_opt = options_from_collection_for_select(@municipalities, :id,
:name) %>
<% puts list_opt %> #ok! list_opt contains the options
$(’#municipality_id’).html(’<%= list_opt %>’);

and this is the combobox in the view:


if instead of ‘<%= list_opt %>’ I manually assign the string


Albano AliceCastello Arborio ...' into list_opt then the combo municipality_id correctly works, if I use options_from_collection_for_select doesn't works (empy combobox) but that string is the same of options_from_collection_for_select

then why doesn’t work ? :frowning:

Thank you,

Solved :smiley:

I forgot escape_javascript:

$(’#event_municipality_id’).html("<%= escape_javascript(opts) %>");