jquery - Passing parameters to Javascript Function -


this view in ruby on rails.i need make call removehistory function when image clicked

<div class=float-right> <img  src="/images/active_star.png" onclick="removehistory('<%= detail.message%>')" /> </div 

and script looks this:

<script type="text/javascript"> function removehistory(text){       alert(text);     } </script> 

this works fine when details.message contains no single or double quotes. need do, make single or double quotes work?

try

<%= j detail.message %> 

or

<%= escape_javascript detail.message %> 

i not sure j alias escape_javascript in rails < 4


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -