Naive question

Got a naive question, and I don’t know what keywords to search for on
google.

I have a webform that needs to query a database in realtime with
javascript. So if I press a button, it will query a database and
return the result to the webpage without reloading the webpage. It
should use ajax.

I assume rails have some sort of ajax-y type of thing that makes this
query possible. What is this called? I don’t know what terms to type
into google.

the most simple way to do this would be link_to_remote
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000958

this makes an ajax call to the controller/action on the server, which
then can make the db query and render the results.
but there are many commands and ways to do this, depending on your needs

To do what, exactly?

Quoting is handy!

Julian.

Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) VIDEO #3
OUT APRIL 6
http://sensei.zenunit.com/

The thing you’re after is most likely observe_field. Things to
remember when using AJAX are that you need to include the default
javascripts in your layout, and to look at the log files a lot when
debugging it.

Using RJS templates is easier than using the :update argument on the
observe_field helper tag.

Julian.

Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) VIDEO #3
OUT APRIL 6
http://sensei.zenunit.com/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs