jquery - Trouble with converting an array of strings into an array of objects-JSON.parse -


i know not horribly difficult based on i've been reading, keep getting error msg. along lines of unexpected identifier.

https://gist.github.com/2869105

the gist shows relevant info i'll add main js here.

- content_for :javascripts    - cache('search_autocomplete')     :javascript       $(function(){       var products = #{auto_complete_products.to_json};         $("#keywords").autocomplete(products,{         appendtoelement: ".autocomplete"           });       }); 

this how set up. want convert array of strings array of objects, adding image along current name when autocomplete occurs.

rails 3.0.7 mac os x lion haml/sass

note second file in gist tried, did not work.

any appreciated. thanks!

i use autocomplete feature way: $('#keywords').autocomplete({source: array_or_hash_or_path}).

so guess need this:

$("#keywords").autocomplete({source: #{auto_complete_products.to_json}}) 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -