how to give controller return value into jquery.html()

12 views
Skip to first unread message

amruby

unread,
Jun 26, 2012, 3:16:27 AM6/26/12
to rubyonra...@googlegroups.com

here this 
format.json { render :json => @cnames }
 from the controller searchskill. this @cnames is a hash, so how to give each value from that @cnames using itetrate in .html()

can i give anything like this...
like this  $('.searchmodal').( <%= @cnames .each do |doc| %> +'<label>'+ <%= doc.name %>+' </label>'+ <% end %>  );  

Ajax file

$.ajax({
type: "POST",
data: dataString,
datatype: "json",
success: function(response){

//.html


}
});
}
Reply all
Reply to author
Forward
0 new messages