Ajax link_to_remote with toggle_blind

I’m having some problems with this link_to_remote call. What I want
ideally is if the user needs more information they can click on the name
and have the details show up. I want to only make the query for more
information when they click rather than loading all the information and
hiding it from the start (no need to send info that will never be
displayed).

Once they click for more details they can toggle the details to show or
hide by clicking the same name. So ideally I want the first click to go
and get the info and then subsequent clicks to toggle the display of the
info.

What I have now does that; it will go and get it with the link_to_remote
call, but once it is finished it will blind up immediately. I basically
want the blind to stay down with freshly retrieved data.

Below is the code:

<%= link_to_remote( child.value.to_s,
:update => container,
:url =>{ :action => :add_children},
:with => withText,
:success =>visual_effect(:toggle_blind, container, :duration => 0.2) )%>

Any suggestions would be greatly appreciated,
Chris

sounds like what you want is first click requests and shows. second
click hides the data, third click shows again.

So,

try

link_to child.value.to_s, ‘#’, {
:onclick => “show_hide_with_ajax(#{container}, #{withText})”}

Great thanks Keynan,

I had to modify that code a little bit, but it sure helped. Everything
is working as it should. Except when I scroll down and click a link
further down the page, it will pop me back up to the top of the page.
The action happened as it should, but I need to scroll back down to
where I was. Kind of annoying.

Any suggestions?