Cannot render javascript from controller
Posted
by Ermin
on Stack Overflow
See other posts from Stack Overflow
or by Ermin
Published on 2010-05-17T14:04:25Z
Indexed on
2010/05/17
16:40 UTC
Read the original article
Hit count: 261
ruby-on-rails
|rjs
I want to display a modal window with an error message, when the user has entered something invalid in a form, but render another action if everything is ok. However, when I try to display the modal window with
render :js => "jQuery.facebox(#{...})"
only the actual javascript called is displayed:
try {
jQuery.facebox(...)
} catch (e) { alert('RJS error:\n\n' + e.toString()); alert('jQuery.facebox(\"<div class=\'error\'>Error</div>\")'); throw e
}
© Stack Overflow or respective owner