Skip to content

Instantly share code, notes, and snippets.

@lightcap
Created October 20, 2009 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lightcap/214430 to your computer and use it in GitHub Desktop.
Save lightcap/214430 to your computer and use it in GitHub Desktop.
<%= javascript_tag "var auth_token = #{form_authenticity_token.inspect};" if protect_against_forgery? %>
results in:
//<![CDATA[
var auth_token = "ZOqYXojCWdc5FZlFY11sHtDW4dnC9eh2/G2M7PcDEDY=";
//]]>
</script>
When called like:
$j('#image-wall a.delete.remote').live("click", function () {
if (confirm('Are you sure?')) {
$j.post(this.href, { photo_id: $j(this).parents("li").attr("id").split("_")[1], authenticity_token: auth_token }, null, "script");
return false;
}
return false;
});
Has spaces in the authenticity_token where "+" would be.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment