Created
April 1, 2009 17:24
-
-
Save baldwindavid/88795 to your computer and use it in GitHub Desktop.
Jquery / Rails Basic Setup
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
// outside of this you can refer to jQuery as $j | |
$j = jQuery.noConflict(); | |
jQuery(document).ready(function($){ | |
// your stuff goes here! | |
// just use $ to refer to jQuery from within here | |
}); | |
jQuery.ajaxSetup({ | |
'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} | |
}); | |
jQuery(document).ajaxSend(function(event, request, settings) { | |
if (typeof(AUTH_TOKEN) == "undefined") return; | |
settings.data = settings.data || ""; | |
settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment