Do you mean Ajax, or UJS? UJS is unobtrusive JavaScript which means the 
JavaScript handling code is decorated on the HTML AFTER the page loads so that 
it doesn't make the HTML invalid and so that things like Braille readers still 
work with it. 

RJS on the other hand is Ajax where parts of the page are updated independently 
of the whole page. 

You say UJS but you talk as if you mean AJAX using RJS templates. 

There are good simple examples all over the web for both of these. 

Blog: http://random8.zenunit.com/
Twitter: http://twitter.com/random8r
Learn: http://sensei.zenunit.com/
New video up now at http://sensei.zenunit.com/ real fastcgi rails deploy 
process! Check it out now!


On 19/04/2011, at 6:25 AM, Tom Ricks <li...@ruby-forum.com> wrote:

> Hello,
> 
> I have the view:
> 
> <% form_tag '/' do %>
>  <%= number_field_tag(:number_one) %>
>  <%= number_field_tag(:number_two) %>
>  <%= submit_tag 'Calculate' %>
> <% end %>
> <%= @number %>
> 
> and the controller:
> 
> def add
>  numberone = params[:number_one].to_f
>  numbertwo = params[:number_two].to_f
>  @number = numberone + numbertwo
> end
> 
> I am trying to learn some ujs in rails with this example, but I can't
> get it to work. I would like it to not refresh the page to load @number
> unobtrusively. Every time I try the submit_tag just stops working. I
> have read many tutorials and such teaching how to get form_for forms to
> use javascript, but not an example as simple as mine. Should I create a
> .js file named add.js? ect. ect.
> 
> Point me in the right direction?
> 
> Thanks
> 
> -- 
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 

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

Reply via email to