AJAX and radio buttons

Hi!

How can i use ajax with radio buttons?

I have form with 2 radio buttons, which updates div with the value of
selected radio button. It worked correctly when i used submit button,
but when i removed it and used observers it didn’t. When i press the
first button it displays its value, but when i press the second button
it displays new value for a moment (0.5s ?) and then suddenly changes to
the first value.
Is there a way to send values just on ‘onclick’ or ‘onchange’ events?

Here’s my observer:

<%= observe_field(“user_osoba”, :frequency => 0.5,
:update => “new_user_form”, :url => { :action => ‘select_type’,
:type => ‘person’ }) %>

and here’s ‘select_type’ action:

def select_type
@type = params[:type] || ‘’
if @type == ‘person’
render :text => @type
elsif @type == ‘company’
render :text => @type
end
end

I’ve simplified select_type action, but it still doesn’t work:

def select_type
render :text => request.raw_post
end

It behaves really strange - it works few times, then after clicking
another radio button the value disappears. I’ve tried it on IE6, FF 1.5
and Opera 8.51 and it didn’t work correctly on any of these browsers.