ruby on rails - Cannot render javascript from controller -


I want to display a modal window with an error message when the user entered something invalid in a form, But the second action is all right, however, when I try to display the model window with

  render: js = & gt; "JQuery.facebox (# {...})"  

Only real javascript is displayed:

  try {jQuery.facebox (. .)} Hold (e) {warning ('rjs error: \ n \ n' + e.oststring ()); Warning ('jQuery.facebox (\ "and' lt; div class = \ 'error \'> error ; \ ')'); throw e}  
< / Div>

Did you try to enter the code partially? Therefore

  render Instead: js = & gt; "JQuery.facebox (# {...})"  

Try

  Render: partial = & gt; "My_facebox_popup"  

Then enter your code within your _my_facebox_popup.html .rb partial:

  

  

Comments