Gerald Anderson wrote:> I don''t know why, but I am drawing a complete blank on something
that
> should be easy. I''ve been searching, perhaps using wrong terms,
and
> still not coming up with anything. Here''s what I''m trying
to do:
>
> <div class="button"
>
onMouseOver=''this.className="button_hover"'';
> onMouseOut
=''this.className="button"'';
> onClick
=''this.className="button_click";
> open("/main/test");''>
> Clear Event
> </div>
>
> Where the div is a homemade css button. onClick, the button needs to
> make a change in css class and make an js/ajax call to a url (will be
> generated with rails, but /main/test is proof of concept). I''m
not at
> all sure how to handle this, and I know I should know, hehe.
>
> I would appreciate any help getting my brain turned around the right way
> on this.
>
> Thanks!
>
> gander
you want something like:
<div class="button"
onclick="this.className=''foo'';
<%= remote_function :url => {:action =>
''foo''},
:loading =>
"$(''ajax_indicator'').show();"
%>">
That should fire off an ajax request when clicked.
--
Posted via http://www.ruby-forum.com/.