I have searched google for any basic Ruby on Rails application with
Ajax. Any basic example where after clicking the button a webpage the
application connects to the database and execute the query using AJAX
and prints the information on the same page. Actually I have to give a
presentation of a simple application of ruby on rails with Ajax.
I have searched google for any basic Ruby on Rails application with
Ajax. Any basic example where after clicking the button a webpage the
application connects to the database and execute the query using AJAX
and prints the information on the same page. Actually I have to give a
presentation of a simple application of ruby on rails with Ajax.
Any information will be appreciated.
To find Ajax info related to Rails, you might want to search for rjs:
I have searched google for any basic Ruby on Rails application with
Ajax. Any basic example where after clicking the button a webpage the
application connects to the database and execute the query using AJAX
and prints the information on the same page. Actually I have to give a
presentation of a simple application of ruby on rails with Ajax.
Any information will be appreciated.
To find Ajax info related to Rails, you might want to search for rjs:
:: put in the views layouts folder file name, header area
<%= javascript_include_tag :defaults %>
:: put where you want the link to be. you can cut it down if you want
<%= link_to_remote ‘CLICK ON LINK NAME’,
:update => ‘div_area’,
:url => { :controller => ‘name’, :action => ‘name’},
:before => “$(‘indicator’).show()”,
:success => “$(‘here’).visualeffect(‘highlight’)”,
:failure => “alert(‘There was a failure error.’)”,
:complete => “$(‘indicator’).hide()”
%>
TEXT TO DISPLAY WHILE GETTING THE REMOTE LINK
Trent,
I think there’s knowing it and knowing how to explain it. If the
latter is the prize, you win it!
I’m just completing a one year, 2000 hour Rails project with zillions
of controllers and views and have always thought someday?? I’d get on
the Java bandwagon. Thanks…
What does the “here” mean in the :success statement? Would you expect
the ‘stuff’ inside the “div_area” to be a partial?
I am grateful for any mentoring.
Kathy
Trent,
I think there’s knowing it and knowing how to explain it. If the
latter is the prize, you win it!
I’m just completing a one year, 2000 hour Rails project with zillions
of controllers and views and have always thought someday?? I’d get on
the Java bandwagon. Thanks…
What does the “here” mean in the :success statement? Would you expect
the ‘stuff’ inside the “div_area” to be a partial?
I am grateful for any mentoring.
Kathy
‘here’ is a typo on my part. doh! it is really ‘div_area’
what will go in the div_area is what is rendered by the :action.
so if the action name has a matching file name in the views/app name
folder, that is what is rendered.
if the action name, in the controller, is:
def time @t = Time.now.to_s
end
the views folder file named time.rhtml gets put in the div_area.
for example, just this one line will work in time.rhtml:
THE TIME IS: <%= @t %>
time.rhtml sits in the view folder of the controller that you are
calling in the link_to_remote call.
Trent,
I think there’s knowing it and knowing how to explain it. If the
latter is the prize, you win it!
I’m just completing a one year, 2000 hour Rails project with zillions
of controllers and views and have always thought someday?? I’d get on
the Java bandwagon. Thanks…
What does the “here” mean in the :success statement? Would you expect
the ‘stuff’ inside the “div_area” to be a partial?
I am grateful for any mentoring.
Kathy
‘here’ is a typo on my part. doh! it is really ‘div_area’
what will go in the div_area is what is rendered by the :action.
so if the action name has a matching file name in the views/app name
folder, that is what is rendered.
if the action name, in the controller, is:
def time @t = Time.now.to_s
end
the views folder file named time.rhtml gets put in the div_area.
for example, just this one line will work in time.rhtml:
THE TIME IS: <%= @t %>
time.rhtml sits in the view folder of the controller that you are
calling in the link_to_remote call.
I really appreciate the input of everyone. Sadly I am too new with Rails
and the only reason for me to take this path is to give a presentation
about how to incorporate Ajax in Ruby On Rails project. I have three
more days to present my presentation, so I think with what I have read
about it in Ajax On Rails book and your responses, I think I might be
able to pull it off.
People say that I am Java programmer and most of it I have learned
writing,running and fixing real code. I will look in more about some
working examples as that will help me create my own presentation.
Thank you very much, and I really appreciate all the responses and
looking forward in using this knowledge in my project.
Thank you
Syed
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.