Ruby on Rails
Tuesday, June 26, 2012
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:
$.each(data.cnames, function(i, doc){
'<label>'+ doc.name +' </label>'
})
}
Pada Selasa, 26 Juni 2012 14:16:27 UTC+7, amruby menulis:
here thisformat.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}});}
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment