Ajax / Effects-only link
<a href="#" onclick="Effect.toggle('widget_preview', 'blind');return false;">Blog this ...a>
TextSnippets > deckard > ajax
2807 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
<a href="#" onclick="Effect.toggle('widget_preview', 'blind');return false;">Blog this ...a>
def toggle_showall render(:update) do |page| page[:fb_content].replace_html "just text? ripoff!" page[:flash_box].visual_effect :blind_down, :duration => 0.25 end end
page[:fb_content]
page[:fb_content].replace_html "just text? ripoff!"
page[:fb_content].replace_html :partial => "shared/some_partial"
page[:flash_box].visual_effect :blind_down, :duration => 0.25
<select id='element_id' onChange="some_javascript_func"> <a href="#" onclick="$('element_id').onchange();">
div.loading { background: url(/images/dots-white.gif) no-repeat 8px 6px; text-indent: -999px; }
<div id="lc" class=""> <%= link_to_remote 'toggle action', { :url => toggle_showall_new_recipe_path, :method => :get, :before => "Element.addClassName('lc', 'loading')", :complete => "Element.removeClassName('lc', 'loading')"}, :class => 'loading xhr', :id => 'xhr-link' %>
def original_control_handler [misc methods and other things] [done normally in this controller] render :update do |page| page.replace_html 'calling_element_id', :partial => 'updated_template' page.helper 'helper_id', :helper_options => 'go here' end end
... page.replace_html 'element_to_update', "this string goes in element"
page.replace 'element2_to_update', (link_to_remote "link_text", {:url => dest, :method => :get, :id => 'element2_to_update')
?chapter=9&sort_by=created_at&sort_dir=desc
:with => "'chapter='+ encodeURIComponent(value)+'&sort_by=#{@sort_by}&sort_dir=#{@sort_dir}&='", :update => 'list_items'
<%= javascript_include_tag "prototype" %>
<%= link_to_function @toggle_text, remote_function(:url => watch_lists_path, :method => :post, :with => "Form.serialize('watch_form')", :update => 'follow_anchor'), :id => 'follow_anchor' %>
def create @watch_list = WatchList.new(params[:watch_list]) if @watch_list.toggle render(:text => @watch_list.toggle_text) else render(:text => 'We couldn''t add this book to your Watch List. Please contact us for help.') end end