I''m trying to reload a page element with RJS after an ajax call and it
works in FireFox but not IE.
######################################
# the method in products_controller.rb
######################################
def option_add
@product = Product.find(params[:id])
@option = Option.find(params[:option_id])
@product.options << @option
# update partial
render :update do |page|
page[:options_list].reload
end
end
####################################
# ajax snippet in _options_list.haml
####################################
= link_to_remote image_tag(''cms/add_16.gif'',
:class=>''control'', :id =>
"option_add"), :url => { :action =>
''option_add'', :id => @product.id },
:with =>
"''option_id=''+$F(''option_id'')",
:method => :post, :before =>
"$(''option_add'').hide(
);$(''option_indicator'').show( );", :success =>
"$(''option_add'').show(
);$(''option_indicator'').hide();", :failure =>
"$(''option_add'').show(
);$(''option_indicator'').hide();"
#########################
# full _options_list.haml
#########################
#options_list
- unless @product.options.length == 0;
- @product.options.each do |option|
.option_row
= option.name
= link_to_remote image_tag(''cms/delete_16.gif'',
:alt=>''Delete'',
:id => "option_delete_#{option.id}"), :url => { :action =>
''option_delete'', :id => @product.id }, :with =>
"''option_id=#{ option.id
}''", :method => :post, :before =>
"$(''option_delete_#{option.id}'').hide();$(''option_indicator_#{option.id}'').show(
);", :failure =>
"$(''option_delete_#{option.id}'').show();$(''option_indicator_#{option.id}'').hide();",
:confirm => "Are you sure?"
= image_tag("cms/spinner.gif", :id =>
"option_indicator_#{option.id}", :style =>
"display:none")
- else
%p No options selected.
%dt
%label Available:
%dd
= collection_select(:option, :id, @available_options, :id, :name)
= link_to_remote image_tag(''cms/add_16.gif'',
:class=>''control'', :id
=> "option_add"), :url => { :action =>
''option_add'', :id => @product.id
}, :with =>
"''option_id=''+$F(''option_id'')",
:method => :post, :before =>
"$(''option_add'').hide(
);$(''option_indicator'').show( );", :success =>
"$(''option_add'').show(
);$(''option_indicator'').hide();", :failure =>
"$(''option_add'').show(
);$(''option_indicator'').hide();"
= image_tag("cms/spinner.gif", :id =>
"option_indicator", :class =>
"control", :style => "display:none")
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---