Monday, December 12, 2011

[Rails] Re: executing javascript on the server side

subbarao wrote in post #1036442:
> On Tuesday 13 December 2011 05:16 AM, gerbdla wrote:
>> #execute javascript function here
>> _gaq.push(['_trackEvent',event_category ,event_label, event_action])
>>
>> end
>>
>> can I do something like this?
>>
> try this code
>
> format.js {render :js => "alert('Yse Javascript working fine.');"}

This a nice railscast. You can see how you can create a js.erb file with
the same name of your method that will be executed as part of a js
format response:

http://railscasts.com/episodes/205-unobtrusive-javascript

--
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate