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

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| %>
+‘’+
<%= doc.name %>+’ '+ <% end %> ); *

Ajax file

$.ajax({
type: “POST”,
url: “http://127.0.0.1:3000/users/searchskill”,
data: dataString,
datatype: “json”,
success: function(response){

//.html

}
});
}

u can use jQuery.each()

maybe something like this:

success: function(data){

  • $.each(data.cnames, function(i, doc){
    ‘’+ doc.name +’ ’
    })
    }*

Pada Selasa, 26 Juni 2012 14:16:27 UTC+7, amruby menulis: