Created
September 14, 2009 18:33
-
-
Save robe5/186831 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rails 3 ajax calls | |
$(document.body).observe('click', function(event){ | |
var element = event.findElement("a['data-remote']"); | |
if (element) { | |
var method = element.readAttribute("data-method") || "get"; | |
new Ajax.Request(element.readAttribute("href"), { method: method }); | |
event.stop(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment