Rails ajax response collection_select not populating properly -


in rails app, making ajax request options collection_select. able receive response when same updated on html body, collection_select dropdown shows values entries along "</option>\n". believe response server fine maybe missing on client end.

how can rectified? response received server

$("#filter_user_course").empty().append("<option value=\"7\">kidscourse<\/option>\n<option value=\"6\">testcourse1<\/option>\n<option value=\"8\">quiztest<\/option>"); 

the client end js code here $.get("getsamplelist",$("#filter_example").serialize(), function(data) { console.log(data); $("#filter_target").html(data)}, "script");

this code on rails server side generates ajax response <% resp = escape_javascript(options_from_collection_for_select(@books, :id, :title)) %> $("#filter_user_course").empty().append("<%= resp.html_safe %>");

the collection_select entries


Comments