Ruby on Rails
Sunday, October 27, 2013
You cannot call Ruby code directly from client side. You have to send an AJAX request to some controller for this purpose.
On Sunday, October 27, 2013 9:27:29 PM UTC+5, Ruby-Forum.com User wrote:
-- On Sunday, October 27, 2013 9:27:29 PM UTC+5, Ruby-Forum.com User wrote:
Greetings,
I'm new to rails and currently having couple problems about how to add
javascript functionality into rails.
I have a simple method in the helper and i want to run this code on
button click.
----------------------------------------------------------- -------
module PagesHelper
def show_message
"simple output"
end
end
----------------------------------------------------------- -------
this doesnt work
<%= button_to_function "Print", "show_message()" %>
this doesnt work too
<input onclick=" show_message() " type="button" value="PRINT" />
Can someone please show to properly solve this problem? I would really
apreciate it! thank you!
--
Posted via http://www.ruby-forum.com/.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6667ccb0-d1fc-4a8c-a96d-819e4020fc45%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment