Im trying to use this jquery ui widget for autocompleting a textbox in my app.
I have created an index.json.erb file inside my views/university folder
here’s my current (piece of crap) code
json='['
<% @universities.each do |u| %>
json+='{ "id": "#{@u.name}" , "label":"#{@u.name}" , "value": "#{@u.name}"},'
<% end %>
json+=']'
json
Needless to say it doesnt work at all… its outputting the whole thing.. not my created json file…… I cant find a builder alternative for creating json.
(builder helps creating xml).
please help!
Replace it with this:
Edit: To wrap the label in
<em>, replace the linewith