u can use jQuery.each()
maybe something like this:
*success: function(data){*
* $.each(data.cnames, function(i, doc){
''<label>''+ doc.name +''
</label>''
})
}*
Pada Selasa, 26 Juni 2012 14:16:27 UTC+7, amruby
menulis:>
>
> 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",
> url: "http://127.0.0.1:3000/users/searchskill",
> data: dataString,
> datatype: "json",
> success: function(response){
>
> *//.html*
>
>
> }
> });
> }
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/eQ1sLgxQAjsJ.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.