Skip to content

Instantly share code, notes, and snippets.

@laktek
Created March 24, 2009 01:47
Show Gist options
  • Save laktek/83885 to your computer and use it in GitHub Desktop.
Save laktek/83885 to your computer and use it in GitHub Desktop.
link_to_remote("Remote outauthor", { :url => { :action => "whatnot" }}, { :class => "fine" })
#Currently renders:
<a class="fine" href="#" onclick="new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true}); return false;">Remote outauthor</a>
#suggested view render:
<a class="fine" data-rails-remote="true" href="http://www.example.com/whatnot">Remote outauthor</a>
#Method implemented by jquery.rails.js helper
$(a["data-rails-remote=true"]).($.ajax({
url: $(this).attr("href"),
async: false
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment